home *** CD-ROM | disk | FTP | other *** search
/ Language/OS - Multiplatform Resource Library / LANGUAGE OS.iso / smaltalk / st80_pr4.lha / st80_pre4 / WindowMaker / WM.3 < prev    next >
Text File  |  1993-07-24  |  150KB  |  3,365 lines

  1. "Copyright WilfLalonde, The Object People"!
  2.  
  3. Smalltalk garbageCollect!
  4.  
  5. SwitchController subclass: #ContinuousSwitchController
  6.     instanceVariableNames: ''
  7.     classVariableNames: ''
  8.     poolDictionaries: ''
  9.     category: 'WindowMaker'!
  10.  
  11. !ContinuousSwitchController methodsFor: 'controlling'!
  12. controlActivity 
  13.     "Continuously sends the message as long as the button is depressed."
  14.     self sendMessage!
  15. controlTerminate
  16.     "Restores the button without doing anything more."
  17.     view indicatorReverse.! !
  18.  
  19.  
  20. Object subclass: #WindowMaker
  21.     instanceVariableNames: 'iconView '
  22.     classVariableNames: ''
  23.     poolDictionaries: ''
  24.     category: 'WindowMaker'!
  25.  
  26. !WindowMaker methodsFor: 'instance initialization'!
  27. iconView: aView
  28.     iconView _ aView! !
  29.  
  30. !WindowMaker methodsFor: 'menu messages'!
  31. makeIcon: anIconClassName
  32.     iconView makeIcon: (Smalltalk at: anIconClassName)! !
  33. "-- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- "!
  34.  
  35. WindowMaker class
  36.     instanceVariableNames: ''!
  37.  
  38. !WindowMaker class methodsFor: 'class initialization'!
  39. initialize
  40.     "WindowMaker initialize"
  41.     FormLibrary initialize.
  42.     FormLibrarian initialize.
  43.     Smalltalk garbageCollect. "just in case"
  44.     FormLibrarian decompress.
  45.     Smalltalk garbageCollect. "just in case"
  46.     WindowMakerMasterIconController decompress! !
  47.  
  48. !WindowMaker class methodsFor: 'converting'!
  49. asIcon: encodingOrView
  50.     "Convert the window maker encoding or extended view (an extended standard system view or an extended view) to an icon."
  51.     (encodingOrView respondsTo: #encoding)
  52.         ifTrue: [^self decode: encodingOrView encoding]
  53.         ifFalse: [^self decode: encodingOrView]!
  54. asView: encodingOrView
  55.     "Convert the window maker encoding or extended view (any kind of extended view) to an extended view."
  56.     (encodingOrView isKindOf: View)
  57.         ifTrue: [^encodingOrView]
  58.         ifFalse: [^(self decode: encodingOrView) asView]! !
  59.  
  60. !WindowMaker class methodsFor: 'opening'!
  61. edit
  62.     "Open a new window maker editor."
  63.     (self privateEditorOn: WindowMakerMasterIcon new) controller open
  64.  
  65.     "WindowMaker edit"!
  66. edit: iconItemsOrAView
  67.     "Open a new editor on the parameter."
  68.     (self privateEditorOn: (self asIcon: iconItemsOrAView)) controller open!
  69. open: iconItemsOrAView
  70.     "Open the parameter."
  71.     ^self open: iconItemsOrAView on: nil!
  72. open: encodedWindowOrView on: aModel
  73.     "Opens the parameter (an encoded window or a view) on the model."
  74.     (self asView: encodedWindowOrView) openOn: aModel! !
  75.  
  76. !WindowMaker class methodsFor: 'encoding/decoding'!
  77. decode: encoding
  78.     "Convert the encoding to an icon"
  79.     | aStream |
  80.     aStream _ ReadStream on: encoding.
  81.     ^(Smalltalk at: ('WindowMaker', aStream next, 'Icon') asSymbol) new
  82.         decodeFrom: aStream!
  83. encode: anIcon
  84.     "Convert the icon to an encoding"
  85.     | aStream |
  86.     aStream _ WriteStream on: (String new: 10000).
  87.     self encode: anIcon on: aStream.
  88.     ^aStream contents!
  89. encode: anIcon on: aStream
  90.     "Convert the icon to an encoding"
  91.     aStream nextPutAll: '#('.
  92.     anIcon encodeOn: aStream.
  93.     aStream nextPut: $)! !
  94.  
  95. !WindowMaker class methodsFor: 'private'!
  96. privateEditorOn: anIcon
  97.     "Creates and returns an editor on the given window maker but does not open or start it up."
  98.     | aWindowMaker topView iconView switchesView isOnSelector isOnSelectorArguments switchSelector subviews textView menuView switchView pictureView switchAndPictureView externalView zoomInView zoomOutView subRectangles iconContainerView |
  99.  
  100.     aWindowMaker _ WindowMaker new.
  101.     topView _ StandardSystemView new label: 'Window Maker'; minimumSize: 200@100.
  102.     iconView _ anIcon model: aWindowMaker. iconContainerView _ View new.
  103.     switchesView _ View new.
  104.  
  105.     topView
  106.         label: 'Window Maker'; borderWidth: 1; insideColor: Form white;
  107.         addSubView: switchesView in: (0@0 corner: 1@0.1) borderWidth: 0;
  108.         addSubView: iconContainerView in: (0@0.098 "0.1" corner: 1@1) borderWidth: 1.
  109.  
  110.     iconContainerView
  111.         addSubView: iconView viewport: iconContainerView insetWindow.
  112.  
  113.     isOnSelector _ #isNil. isOnSelectorArguments _ #(). "anything returning false"
  114.     switchSelector _ #makeIcon:.
  115.  
  116.     subviews _ OrderedCollection new
  117.         add: ((textView _ SwitchView new 
  118.             label: 'text' asParagraph; model: aWindowMaker;
  119.             selector: isOnSelector; arguments: isOnSelectorArguments) controller 
  120.                 selector: switchSelector; arguments: #(WindowMakerTextIcon); view);
  121.         add: ((menuView _ SwitchView new 
  122.             label: 'menu' asParagraph; model: aWindowMaker;
  123.             selector: isOnSelector; arguments: isOnSelectorArguments) controller 
  124.                 selector: switchSelector; arguments: #(WindowMakerMenuIcon); view);
  125.         add: ((switchView _ SwitchView new 
  126.             label: 'switch' asParagraph; model: aWindowMaker;
  127.             selector: isOnSelector; arguments: isOnSelectorArguments) controller 
  128.                 selector: switchSelector; arguments: #(WindowMakerSwitchIcon); view);
  129.         add: ((pictureView _ SwitchView new 
  130.             label: 'picture' asParagraph; model: aWindowMaker;
  131.             selector: isOnSelector; arguments: isOnSelectorArguments) controller 
  132.                 selector: switchSelector; arguments: #(WindowMakerPictureIcon); view);
  133.         add: ((switchAndPictureView _ SwitchView new 
  134.             label: 'both' asParagraph; model: aWindowMaker;
  135.             selector: isOnSelector; arguments: isOnSelectorArguments) controller 
  136.                 selector: switchSelector; arguments: #(WindowMakerSwitchAndPictureIcon); view);
  137.         add: ((externalView _ SwitchView new 
  138.             label: 'external' asParagraph; model: aWindowMaker;
  139.             selector: isOnSelector; arguments: isOnSelectorArguments) controller 
  140.                 selector: switchSelector; arguments: #(WindowMakerExternalIcon); view);
  141.         add: ((zoomInView _ SwitchView new 
  142.             label: 'zoom in' asParagraph; model: iconView;
  143.             controller: ContinuousSwitchController new;
  144.             selector: isOnSelector; arguments: isOnSelectorArguments) controller 
  145.                 selector: #zoomIn; arguments: #(); view);
  146.         add: ((zoomOutView _ SwitchView new 
  147.             label: 'zoom out' asParagraph; model: iconView;
  148.             controller: ContinuousSwitchController new;
  149.             selector: isOnSelector; arguments: isOnSelectorArguments) controller 
  150.                 selector: #zoomOut; arguments: #(); view);
  151.         yourself.
  152.  
  153.     subRectangles _ OrderedCollection new
  154.         addAll: ((1 to: 2) collect: [:i | ((i-1)/6)@0 corner: (i/6)@1]); "text, menu"
  155.         addAll: ((3 to: 4) collect: [:i | ((i-1)/6)@0 corner: (i/6)@(1/2)]); "switch, picture"
  156.         add: ([:i :j | ((i-1)/6)@(1/2) corner: (j/6)@1] value: 3 value: 4); "switchAndPicture"
  157.         addAll: ((5 to: 5) collect: [:i | ((i-1)/6)@0 corner: (i/6)@1]); "external"
  158.         addAll: ((6 to: 6) collect: [:i | ((i-1)/6)@0 corner: (i/6)@(1/2)]); "zoom in"
  159.         addAll: ((6 to: 6) collect: [:i | ((i-1)/6)@(1/2) corner: (i/6)@1]); "zoom out"
  160.         yourself.
  161.  
  162.     1 to: subviews size do: [:i |
  163.         switchesView 
  164.             addSubView: (subviews at: i) in: (subRectangles at: i) borderWidth: 1].
  165.  
  166.     aWindowMaker iconView: iconView.
  167.  
  168.     ^topView! !
  169.  
  170.  
  171.  
  172. StandardSystemController subclass: #WindowMakerControllerWithCancel
  173.     instanceVariableNames: 'cancelled initiator '
  174.     classVariableNames: ''
  175.     poolDictionaries: ''
  176.     category: 'WindowMaker'!
  177.  
  178. !WindowMakerControllerWithCancel methodsFor: 'instance initialization'!
  179. initialize
  180.     super initialize.
  181.     cancelled _ false!
  182. initializeBlueButtonMenuWithCancel
  183.     "Initialize the blue button pop-up menu and corresponding array of messages for the receiver. Refer to class method initialize in StandardSystemController for up-to-date menu items."
  184.     self 
  185.         blueButtonMenu: (PopUpMenu
  186.             labels: 'new label\under\move\frame\collapse\close\cancel' withCRs
  187.             lines: #(1 5)) 
  188.         blueButtonMessages: #(newLabel under move frame collapse close cancel)!
  189. initiator: aController
  190.     initiator _ aController! !
  191.  
  192. !WindowMakerControllerWithCancel methodsFor: 'querying'!
  193. cancelled
  194.     ^cancelled! !
  195.  
  196. !WindowMakerControllerWithCancel methodsFor: 'menu messages'!
  197. cancel
  198.     cancelled _ true. "for post-closing interrogation"
  199.     self close!
  200. close
  201.     "Signal the initiating controller."
  202.     initiator forgetPopUpWindow.
  203.     view erase; release.
  204.     ScheduledControllers 
  205.         unschedule: self;
  206.         activeController: initiator view topView controller.
  207.     Processor terminateActive! !
  208. "-- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- "!
  209.  
  210. WindowMakerControllerWithCancel class
  211.     instanceVariableNames: ''!
  212.  
  213. !WindowMakerControllerWithCancel class methodsFor: 'instance creation'!
  214. withCancelFor: aController
  215.     ^self new initiator: aController; initializeBlueButtonMenuWithCancel!
  216. withoutCancelFor: aController
  217.     ^self new initiator: aController! !
  218.  
  219.  
  220. ExtendedSwitchView subclass: #WindowMakerIcon
  221.     instanceVariableNames: 'message messageView messageInitializers messageSources messageCodings messageParsers sizeLocked defaultLabelSelector '
  222.     classVariableNames: ''
  223.     poolDictionaries: ''
  224.     category: 'WindowMaker'!
  225.  
  226. !WindowMakerIcon methodsFor: 'instance initialization'!
  227. initialize
  228.     "Initializes all components of the icon."
  229.     | box |
  230.     super initialize.
  231.     self mode: #varying.
  232.     box _ 0@0 extent: 50@50. self window: box viewport: box. "=> transformation is identity"
  233.     sizeLocked _ false.
  234.     self borderWidth: 1; insideColor: Form white.
  235.     defaultLabelSelector _ #subclassResponsibility.
  236.     self initializeMessages!
  237. initializeMessages
  238.     "Initializes the message components of the icon."
  239.     message _ #comment.
  240.     messageInitializers _ IdentityDictionary new.
  241.     messageSources _ IdentityDictionary new.
  242.     messageCodings _ IdentityDictionary new.
  243.     messageParsers _ IdentityDictionary new.
  244.     self addMessage: #name default: #defaultName 
  245.         parser: #parseNilOrSymbol: coding: #(nil)! !
  246.  
  247. !WindowMakerIcon methodsFor: 'encoding/decoding'!
  248. decodeBorderWidth: data
  249.     "decode integer or #(<left> <top> <right> <bottom>)"
  250.     (data isKindOf: Integer) 
  251.         ifTrue: [^data@data corner: data@data]
  252.         ifFalse: [^(data at: 1)@(data at: 2) corner: (data at: 3)@(data at: 4)]!
  253. decodeColor: aColorSymbol
  254.     aColorSymbol == #nil 
  255.         ifTrue: [^nil]
  256.         ifFalse: [^Form perform: aColorSymbol]!
  257. decodeFrom: aStream
  258.     "iconClass iconName window insideColor borderWidth"
  259.     | border | 
  260.     self
  261.         changeMessage: #name receiver: aStream next;
  262.         window: (self decodeWindow: aStream next);
  263.         insideColor: (self decodeColor: aStream next);
  264.         borderWidthLeft: (border _ self decodeBorderWidth: aStream next) left 
  265.             right: border right top: border top bottom: border bottom!
  266. decodePoint: anArray
  267.     "decode #(<x> <y>)"
  268.     ^(anArray at: 1)@(anArray at: 2)!
  269. decodeSymbolOrNil: aSymbolOrNil
  270.     "decode #symbol or #nil"
  271.     aSymbolOrNil == #nil ifTrue: [^nil] ifFalse: [^aSymbolOrNil]!
  272. decodeWindow: anArray
  273.     "decode #(<origin x> <origin y> <corner x> <corner y>)"
  274.     ^(anArray at: 1)@(anArray at: 2) corner: (anArray at: 3)@(anArray at: 4)!
  275. encodeBorderWidthOn: aStream
  276.     borderWidth = ((0@0 extent: 0@0) translateBy: borderWidth left)
  277.         ifTrue: [aStream print: borderWidth left]
  278.         ifFalse: [aStream print: (Array with: borderWidth left with: borderWidth top 
  279.             with: borderWidth right with: borderWidth bottom)]!
  280. encodeColor: aPoint on: aStream
  281.     insideColor isNil ifTrue: [^aStream print: #nil].
  282.     #(black darkGray gray lightGray veryLightGray white) do: [:candidate |
  283.         (insideColor == (Form perform: candidate)) ifTrue: [^aStream print: candidate]].
  284.     self error: 'unknown insideColor'!
  285. encodeOn: aStream
  286.     "iconClass iconName window insideColor borderWidth"
  287.     aStream 
  288.         nextPutAll: self shortClassName; space; 
  289.         store: (self receiverFor: #name); space. self
  290.         encodeWindowOn: aStream. aStream space. self
  291.         encodeColor: insideColor on: aStream. aStream space. self
  292.         encodeBorderWidthOn: aStream!
  293. encodePoint: aPoint on: aStream
  294.     aStream print: (Array with: aPoint x with: aPoint y).!
  295. encodeWindowOn: aStream
  296.     aStream print: (Array 
  297.         with: window origin x with: window origin y 
  298.         with: window corner x with: window corner y).! !
  299.  
  300. !WindowMakerIcon methodsFor: 'generating views'!
  301. asView
  302.     self subclassResponsibility! !
  303.  
  304. !WindowMakerIcon methodsFor: 'group sequencing'!
  305. groupDo: aBlock
  306.     aBlock value: self!
  307. groupGet: aBlock ifUnequal: anotherBlock
  308.     ^aBlock value: self! !
  309.  
  310. !WindowMakerIcon methodsFor: 'copying'!
  311. shallowCopy
  312.     | copy oldMessageInitializers oldMessageSources oldMessageCodings oldMessageParsers |
  313.     
  314.     "Modify temporarily"
  315.     oldMessageInitializers _ messageInitializers. messageInitializers _ messageInitializers copy.
  316.     oldMessageSources _ messageSources. messageSources _ messageSources copy.
  317.     oldMessageCodings _ messageCodings. messageCodings _ messageCodings copy.
  318.     oldMessageParsers _ messageParsers. messageParsers _ messageParsers copy.
  319.  
  320.     "Make the copy."
  321.     copy _ super shallowCopy
  322.         superView: nil; resetSubViews;
  323.         borderWidthLeft: borderWidth left right: borderWidth right 
  324.             top: borderWidth top bottom: borderWidth bottom;
  325.         transformation: transformation; "stores a copy"
  326.         window: window; "stores a copy"
  327.         yourself.
  328.     subViews do: [:icon | copy addSubView: icon shallowCopy].
  329.  
  330.     "Restore"
  331.     messageInitializers _ oldMessageInitializers.
  332.     messageSources _ oldMessageSources.
  333.     messageCodings _ oldMessageCodings.
  334.     messageParsers _ oldMessageParsers.
  335.  
  336.     ^copy! !
  337.  
  338. !WindowMakerIcon methodsFor: 'size locking'!
  339. sizeLocked
  340.     ^sizeLocked!
  341. sizeLocked: aBoolean
  342.     sizeLocked _ aBoolean! !
  343.  
  344. !WindowMakerIcon methodsFor: 'default naming'!
  345. classNamePicture
  346.     ^self shortClassName asLowercase asParagraph!
  347. shortClassName
  348.     | className |
  349.     className _ self class name. "WindowMaker...Icon"
  350.     ^className copyFrom: 12 to: className size - 4 "the ... portion"! !
  351.  
  352. !WindowMakerIcon methodsFor: 'moving/growing primitives'!
  353. growTo: aPoint
  354.     "Parameter aPoint is in display coordinates."
  355.     sizeLocked ifTrue: [^self].
  356.     window extent = aPoint ifFalse: [window extent: aPoint. self unlock; lock]!
  357. moveBy: aPoint
  358.     "Parameter aPoint is in display coordinates."
  359.     aPoint = (0@0) ifFalse: [window moveBy: aPoint. self unlock; lock]!
  360. scaleBy: scale
  361.     "Scales in the normal way but ensures that the window is the same size as the display box."
  362.     | oldExtent |
  363.     oldExtent _ window extent.
  364.     super scaleBy: scale. "this will change the local transformation"
  365.     self lock.
  366.         window _ superView inverseDisplayTransform: self displayBox.
  367.         transformation _ WindowingTransformation identity.
  368.         sizeLocked ifTrue: [window extent: oldExtent].
  369.     self unlock; lock! !
  370.  
  371. !WindowMakerIcon methodsFor: 'moving/growing non-primitives'!
  372. growBy: aPoint
  373.     "Parameter aPoint is in display coordinates."
  374.     self growTo: (aPoint + self displayBox extent)!
  375. inverseDisplayScale: aPoint
  376.     "Applies the inverse of the scale of the receiver's display transformation. Used to convert a width in display coordinates to window coordinates."
  377.     ^aPoint scaleBy: (1.0@1.0) / self displayTransformation scale!
  378. moveTo: aPoint
  379.     "Parameter aPoint is in display coordinates."
  380.     self moveBy: (aPoint - self displayBox origin)! !
  381.  
  382. !WindowMakerIcon methodsFor: 'displaying'!
  383. computeInsetDisplayBox
  384.     "Overrides the default method to avoid intersecting the result with the superview's display box."
  385.  
  386.     ^(self displayTransform: self getWindow) insetBy: borderWidth!
  387. computeLabel
  388.     "If the user has changed the more important message selector for the icon (which it is depends on the icon), then use the new selector as the label; otherwise, do nothing."
  389.     | theSelector |
  390.     theSelector _ self selectorFor: defaultLabelSelector.
  391.     self label: (theSelector == defaultLabelSelector 
  392.         ifTrue: [self classNamePicture] 
  393.         ifFalse: [theSelector asParagraph])!
  394. dehighlight
  395.     self reverse!
  396. dehighlightOn: aForm at: aPoint clippingBox: aRectangle
  397.     self reverseOn: aForm at: aPoint clippingBox: aRectangle!
  398. displayGrowBoxOn: aForm at: aPoint clippingBox: aRectangle
  399.     | growBox |
  400.     growBox _ (aPoint + self displayBox extent - (8@8)) extent: 8@8.
  401.     (aRectangle contains: growBox) ifTrue: [
  402.         aForm black: growBox.
  403.         aForm white: (growBox insetBy: 2)].!
  404. displayOn: aForm at: aPoint clippingBox: aRectangle rule: ruleInteger mask: maskForm
  405.     "Display the icon and its grow box."
  406.     "First, the border, inside color, and background."
  407.     super displayOn: aForm at: aPoint clippingBox: aRectangle 
  408.         rule: ruleInteger mask: maskForm.
  409.     "Second, the grow box."
  410.     ^self displayGrowBoxOn: aForm at: aPoint clippingBox: aRectangle!
  411. growBoxContainsPoint: aPoint
  412.     ^(self displayBox corner - (8@8) extent: 8@8) containsPoint: aPoint!
  413. highlight
  414.     self reverse!
  415. highlightOn: aForm at: aPoint clippingBox: aRectangle
  416.     self reverseOn: aForm at: aPoint clippingBox: aRectangle!
  417. reverse
  418.     self reverseOn: Display at: self displayBox origin clippingBox: superView insetDisplayBox!
  419. reverseBoundary
  420.     Display 
  421.         border: (self displayBox intersect: superView insetDisplayBox) 
  422.         width: 2 rule: Form reverse mask: Form black.!
  423. reverseOn: aForm at: aPoint clippingBox: aRectangle
  424.     aForm reverse: (((aPoint extent: self displayBox extent) insetBy: borderWidth) intersect: aRectangle)! !
  425.  
  426. !WindowMakerIcon methodsFor: 'alignment window support'!
  427. changeBottom: aDisplayCoordinateInteger
  428.     self moveBy: 0 @ (aDisplayCoordinateInteger - self displayBox corner y)!
  429. changeHeight: aDisplayCoordinateInteger
  430.     self growTo: self displayBox extent x @ aDisplayCoordinateInteger!
  431. changeLeftSide: aDisplayCoordinateInteger
  432.     self moveBy: (aDisplayCoordinateInteger - self displayBox origin x) @ 0!
  433. changeMiddleHorizontally: aDisplayCoordinateInteger
  434.     self moveBy: (aDisplayCoordinateInteger - self displayBox center x) @ 0!
  435. changeMiddleVertically: aDisplayCoordinateInteger
  436.     self moveBy: 0 @ (aDisplayCoordinateInteger - self displayBox center y)!
  437. changeRightSide: aDisplayCoordinateInteger
  438.     self moveBy: (aDisplayCoordinateInteger - self displayBox corner x) @ 0!
  439. changeTop: aDisplayCoordinateInteger
  440.     self moveBy: 0 @ (aDisplayCoordinateInteger - self displayBox origin y)!
  441. changeWidth: aDisplayCoordinateInteger
  442.     self growTo: aDisplayCoordinateInteger @ self displayBox height!
  443. growCornerBy: aDisplayCoordinateDelta
  444.     self error: 'obsolete method'.
  445.     self growBy: aDisplayCoordinateDelta
  446. "
  447.     window corner: window corner + (self inverseDisplayScale: aDisplayCoordinateDelta).
  448.     self unlock; lock
  449. "! !
  450.  
  451. !WindowMakerIcon methodsFor: 'interface window direct support'!
  452. message
  453.     ^message!
  454. message: aSymbol
  455.     message _ aSymbol!
  456. messageCodings
  457.     ^messageCodings!
  458. messageInitializers
  459.     ^messageInitializers!
  460. messageSources
  461.     ^messageSources!
  462. messageView
  463.     ^messageView!
  464. messageView: aView
  465.     messageView _ aView! !
  466.  
  467. !WindowMakerIcon methodsFor: 'interface window general support'!
  468. addMessage: nameSymbol default: defaultSymbol parser: parseSymbol coding: anArrayOrNil
  469.     messageInitializers at: nameSymbol put: defaultSymbol.
  470.     messageSources at: nameSymbol put: (self perform: defaultSymbol).
  471.     messageParsers at: nameSymbol put: parseSymbol.
  472.     messageCodings at: nameSymbol put: anArrayOrNil!
  473. argumentsFor: nameSymbol
  474.     "Assumes the coding is not #(nil)."
  475.     | coding result |
  476.     coding _ messageCodings at: nameSymbol. result _ OrderedCollection new.
  477.     3 to: coding size by: 2 do: [:index | result add: (coding at: index)].
  478.     ^self translateConstants: result asArray!
  479. changeMessage: nameSymbol receiver: aSymbol
  480.     "Places the symbol into an array as required for the coding."
  481.     ^self changeMessage: nameSymbol coding: (Array with: aSymbol)!
  482. changeMessage: nameSymbol receiverSelectorArguments: anArray
  483.     "Passes it on as a private message."
  484.     ^self changeMessage: nameSymbol coding: anArray!
  485. changeMessage: nameSymbol selectorArguments: anArray
  486.     "Adds 'model' in front of arrays other than #(nil)."
  487.     | coding |
  488.     coding _ anArray = #(nil) ifTrue: [#(nil)] ifFalse: [(Array with: #model), anArray].
  489.     ^self changeMessage: nameSymbol coding: coding!
  490. codingFor: nameSymbol
  491.     "Entire coding is returned."
  492.     ^messageCodings at: nameSymbol!
  493. codingWithoutReceiverFor: nameSymbol
  494.     "Treats situation with missing selector; i.e., #(nil), specially by returning #(nil)."
  495.     | coding |
  496.     (coding _ messageCodings at: nameSymbol) = #(nil) ifTrue: [^coding].
  497.     ^coding copyFrom: 2 to: coding size "eliminate receiver"!
  498. receiverFor: nameSymbol
  499.     "Translates constants."
  500.     | receiver |
  501.     receiver _ (messageCodings at: nameSymbol) first.
  502.     ^(self translateConstants: (Array with: receiver)) first!
  503. receiverSelectorArgumentsFor: nameSymbol
  504.     "Treats situation with missing selector; i.e., #(nil) specially by returning nil."
  505.     | theReceiver theSelector theArguments |
  506.     (messageCodings at: nameSymbol) = #(nil) ifTrue: [^nil].
  507.     theReceiver _ self receiverFor: nameSymbol.
  508.     theSelector _ self selectorFor: nameSymbol.
  509.     theArguments _ self argumentsFor: nameSymbol.
  510.     ^Array with: theReceiver with: (theArguments isEmpty
  511.         ifTrue: [theSelector]
  512.         ifFalse: [ExtendedMessage selector: theSelector arguments: theArguments])!
  513. selectorArgumentsFor: nameSymbol
  514.     "Treats situation with missing selector; i.e., #(nil) specially by returning nil."
  515.     | theSelector theArguments |
  516.     (messageCodings at: nameSymbol) = #(nil) ifTrue: [^nil].
  517.     theSelector _ self selectorFor: nameSymbol.
  518.     theArguments _ self argumentsFor: nameSymbol.
  519.     theArguments isEmpty
  520.         ifTrue: [^theSelector]
  521.         ifFalse: [^ExtendedMessage selector: theSelector arguments: theArguments]!
  522. selectorFor: nameSymbol
  523.     "Treats situation with missing selector; i.e., #(nil) specially by returning nil."
  524.     | coding result |
  525.     (coding _ messageCodings at: nameSymbol) = #(nil) ifTrue: [^nil].
  526.     result _ ''.
  527.     2 to: coding size by: 2 do: [:index | result _ result, (coding at: index)].
  528.     ^result asSymbol! !
  529.  
  530. !WindowMakerIcon methodsFor: 'interface window defaults'!
  531. defaultGetYellowMenu
  532.     ^Text
  533.         string: '
  534.     model getYellowMenu
  535.  
  536. "other examples:
  537.     nil
  538.     model getYellowMenu: #leftPane
  539.     model getYellowMenu: ''method'' suffix: '' categories''
  540.  
  541. comment: The get-menu message (if not nil) is used by the window to ask the model for the yellow-button pop-up menu to be used. 
  542.  
  543. when used: This message is sent to the model each time the user presses the yellow button while in this window. The entries in the menu may be different each time.
  544.  
  545. restrictions: For non-nil messages, the receiver must be ''model''. Any number of constant parameters can be specified; nil, true, and false are permitted. The result returned must be either an action menu or nil. 
  546.  
  547. action menus: For text windows (only), the action menu normally includes the standard text editing selectors ''again, undo, copySelection, cut, paste, accept, cancel'' in addition to user selectors. The user selectors can either have no parameters or two parameters (the current text and the controller). When selected, the editing selectors are handled automatically by the text window; the user selectors are sent as messages to the model.
  548.  
  549. action menu example:
  550.  
  551.     ActionMenu
  552.         labels: ''again\undo\copy\cut\paste\accept\cancel\mine1\mine2'' withCRs
  553.         lines: #(2 5 7)
  554.         selectors: #(again undo copySelection cut paste accept cancel mine1 mine2:and:)
  555.  
  556. warning: The text object passed in the first of two parameter selectors (e.g., mine2:and: above) is the actual text used by the text window. This text could be stored in the model. However, subsequent destructive changes by the window will cause it to change. If the stored version is to be left intact, care should be taken to store a copy."'
  557.         runs: (RunArray
  558.             runs: #(8 13 3 14 14 13 19 13 11 6 17 7 5 9 17 3 89 9 156 12 106 3 2 4 6 5 54 11 4 3 4 12 98 5 2 4 2 13 2 3 2 5 2 6 2 6 37 14 17 13 4 14 178 19 17 6 66 5 13 9 72 7 72 5 1 3 240 12 2 )
  559.             values: #(1 2 1 2 1 2 1 2 1 2 1 2 1 2 1 2 1 2 1 2 1 2 1 2 1 2 1 2 1 2 1 2 1 2 1 2 1 2 1 2 1 2 1 2 1 2 1 2 1 2 1 2 1 2 1 2 1 2 1 2 1 2 1 2 1 2 1 2 1 ))!
  560. defaultName
  561.     ^Text
  562.         string: '
  563.     nil
  564.  
  565. "other examples:
  566.     workWindow
  567.     top
  568.  
  569. comment: A view name can be used to access the view when pre-opening or post-closing an extended standard system view.
  570.  
  571. restrictions: A view name must either be nil or a symbol.
  572.  
  573. additional information: For a more detailed explanation, see comment in the external interface for the master window; i.e., get the yellow-button pop-up menu when no icons are selected and choose the external interface entry."'
  574.         runs: (RunArray
  575.             runs: #(8 14 20 7 9 4 37 11 4 12 36 12 47 22 204 )
  576.             values: #(1 2 1 2 1 2 1 2 1 2 1 2 1 2 1 ))!
  577. defaultUpdateSymbol
  578.     ^Text
  579.         string: '
  580.     nil
  581.  
  582. "other examples:
  583.     color
  584.     shade
  585.  
  586. comment: An update symbol can be used by the model to cause all (and only) windows with the corresponding update symbol to update themselves. To do this, the model sends the message ''self changed: #updateSymbol''.
  587.  
  588. restrictions: An update symbol must either be nil or a symbol.
  589.  
  590. how windows update: The exact manner depends on the kind of window; e.g., a text window obtains new text from the model, a menu window obtains a new permanent menu and a new selection from the model, a switch window asks the model if it is on, and a picture window with dynamic pictures asks the model for a new picture.
  591.  
  592. illustration: Suppose a number of switches select shades (white, gray, black) by sending appropriate ''switchColor: aSymbol'' messages to the model. Moreover, suppose a text window is intended to display the current shade and a menu window is intended to display all three entries with the appropriate one selected. Communication between the switches and the text and menu window can be achieved by providing the following methods in the model.
  593.  
  594.     switchColor: aSymbol
  595.         ""This is a switch window method""
  596.         currentColor _ aSymbol.
  597.         self changed: #color
  598.  
  599.     getText
  600.         ""This is a text window method""
  601.         ^currentColor asText
  602.  
  603.     getMenu
  604.         ""This is a menu window method""
  605.         ^#(white gray black)
  606.  
  607.     getMenuSelection
  608.         ""This is a menu window method""
  609.         ^currentColor
  610.  
  611. The ''self changed: #shade'' message will cause all windows with update symbol ''shade'' to update themselves. In this case, the text window uses its getText message while the menu window uses its getMenu and getMenuSelection messages. Alternate names for getText, getMenu, and getMenuSelection can be specified by the window designer."'
  612.         runs: (RunArray
  613.             runs: #(8 14 17 7 5 13 189 12 52 18 304 12 433 12 79 8 10 7 61 7 61 16 385 )
  614.             values: #(1 2 1 2 1 2 1 2 1 2 1 2 1 2 1 2 1 2 1 2 1 2 1 ))! !
  615.  
  616. !WindowMakerIcon methodsFor: 'message parsing'!
  617. parseBoolean: aText
  618.     | anArray receiver object |
  619.     anArray _ self parseText: aText. anArray isEmpty ifTrue: [^#()].
  620.     (anArray = #(true)) | (anArray = #(false)) ifTrue: [^anArray].
  621.     self reportError: 'expected "true" or "false"'.
  622.     ^#()!
  623. parseClassMessage: aText
  624.     | anArray receiver object |
  625.     anArray _ self parseText: aText. anArray isEmpty ifTrue: [^#()].
  626.     receiver _ anArray at: 1.
  627.     (self messageSizeOk: anArray size: -2) ifFalse: [^#()].
  628.     object _ Smalltalk at: receiver ifAbsent: [#()].
  629.     (object respondsTo: #superclass) ifFalse: [
  630.         self reportError: 'expected "', receiver printString, '" to be a class'.
  631.         ^#()].
  632.     (self messageSelectorsOk: anArray) ifFalse: [^#()].
  633.     ^anArray!
  634. parseComment: aText
  635.     ^#(nil)!
  636. parseNilOrString: aText
  637.     ^self parseNilOrString: aText symbolNeeded: false!
  638. parseNilOrSymbol: aText
  639.     ^self parseNilOrString: aText symbolNeeded: true!
  640. parseNilOrZeroOrMoreParameterMessage: aText
  641.     ^self parseMessage: aText nilOk: true size: -2!
  642. parseOneOrMoreParametersMessage: aText
  643.     ^self parseMessage: aText nilOk: false size: -3!
  644. parseText: aText forMessage: aSymbol
  645.     ^self perform: (messageParsers at: aSymbol) with: aText!
  646. parseZeroOrMoreParametersMessage: aText
  647.     ^self parseMessage: aText nilOk: false size: -2!
  648. unparseMessage: aSymbol
  649.     "Converse of the parseMessage methods. Must be generalized if additional cases need to be handled."
  650.     | parser coding element string |
  651.     parser _ messageParsers at: aSymbol. coding _ messageCodings at: aSymbol.
  652.     parser == #parseComment ifTrue: [^self perform: (messageInitializers at: aSymbol)].
  653.     parser == #parseNilOrSymbol: ifTrue: [^(coding at: 1) storeString asText].
  654.     1 to: coding size do: [:index |
  655.         element _ coding at: index.
  656.         index = 1
  657.             ifTrue: [string _ element printString]
  658.             ifFalse: [
  659.                 index even
  660.                     ifTrue: [string _ string, ' ', element printString]
  661.                     ifFalse: [string _ string, ' ', element storeString]]].
  662.     ^string asText! !
  663.  
  664. !WindowMakerIcon methodsFor: 'private message parsing support'!
  665. changeMessage: nameSymbol coding: coding
  666.     messageCodings at: nameSymbol put: coding.
  667.     messageSources at: nameSymbol put: (self unparseMessage: nameSymbol).
  668.     nameSymbol == defaultLabelSelector ifTrue: [self computeLabel].!
  669. evaluate: aText
  670.     | notifier |
  671.     notifier _ ErrorHandler new errorBlock: [:string :position |
  672.         "Eliminate '#(' part of '#(....)'."
  673.         self reportError: string at: position-2.
  674.         ^nil].
  675.     ^Compiler evaluate: '#(', aText, ')' notifying: notifier logged: false!
  676. messageReceiverOk: anArray
  677.     (anArray at: 1) == #model
  678.         ifTrue: [^true]
  679.         ifFalse: [self reportError: 'expected "model"'. ^false]!
  680. messageSelectorsOk: anArray
  681.     | even element |
  682.  
  683.     "Special case: <receiver selector>."
  684.     anArray size = 2 ifTrue: [
  685.         (((element _ anArray at: 2) isKindOf: Symbol) and: 
  686.         [element first isLetter])
  687.             ifTrue: [^true]
  688.             ifFalse: [self reportError: 'selector must be a symbol'. ^false]].
  689.  
  690.     "Special case: <receiver selector operand>."
  691.     anArray size = 3 ifTrue: [
  692.         (((element _ anArray at: 2) isKindOf: Symbol) and: 
  693.         [element first isLetter ifTrue: [element last == $:] ifFalse: [true]])
  694.             ifTrue: [^true]
  695.             ifFalse: [self reportError: 'selector must be special character or symbol ending with ":"'. ^false]].
  696.  
  697.     "General case: <receiver keyword: operand keyword: operand ...>."
  698.     even _ false.
  699.     anArray do: [:component |
  700.         even ifTrue: [
  701.             ((component isKindOf: Symbol) and: [component first isLetter]) 
  702.                 ifFalse: [self reportError: 'selector must be a symbol'. ^false].
  703.             (component last = $:) 
  704.                 ifFalse: [self reportError: 'selector must end with ":"'. ^false]].
  705.         even _ even not].
  706.     ^true!
  707. messageSizeOk: anArray size: legalSize
  708.     "If legalSize is positive, exactly that size is required; if negative, any size >= legalSize abs is permitted."
  709.     legalSize negative 
  710.         ifTrue: [
  711.             anArray size >= legalSize abs
  712.                 ifTrue: [^true]
  713.                 ifFalse: [self reportError: 'expected more parameters'. ^false]]
  714.         ifFalse: [
  715.             anArray size = legalSize
  716.                 ifTrue: [^true]
  717.                 ifFalse: [
  718.                     anArray isEmpty ifTrue: [self reportError: 'expected something'. ^false].
  719.                     legalSize = 2 ifTrue: [self reportError: 'expected "model selector"'. ^false].
  720.                     self reportError: 'expected "model keyword1: constant1 keyword2: constant2 ..."'.
  721.                     ^false]]!
  722. parseMessage: aText nilOk: nilLegal size: legalSize
  723.     "Returns an array containing the text; either the elements of a message or nil for legal text (the latter only if nilLegal is true); #() is returned if an error is reported. The message elements have the form <receiver selector> or <receiver keyword1: constant1 keyword2: constant2 ...>."
  724.     | anArray |
  725.     anArray _ self parseText: aText. anArray isEmpty ifTrue: [^#()].
  726.     (nilLegal and: [anArray = #(nil)]) ifTrue: [^anArray].
  727.     (self messageSizeOk: anArray size: legalSize) ifFalse: [^#()].
  728.     (self messageReceiverOk: anArray) ifFalse: [^#()].
  729.     (self messageSelectorsOk: anArray) ifFalse: [^#()].
  730.     ^anArray!
  731. parseNilOrString: aText symbolNeeded: symbolNeeded
  732.     "Returns an array containing the text; either a symbol (name), a string, or nil for legal text (the former only if symbolNeeded is true); #() is returned if an error is reported."
  733.     | anArray legal string |
  734.     anArray _ self parseText: aText. anArray isEmpty ifTrue: [^#()].
  735.     anArray = #(nil) ifTrue: [^anArray].
  736.     legal _ (anArray size = 1) and: 
  737.         [symbolNeeded 
  738.             ifTrue: [((string _ anArray first) isKindOf: Symbol) and: [string first isLetter]] 
  739.             ifFalse: [anArray first isKindOf: String]].
  740.     legal ifTrue: [^anArray].
  741.     self reportError: (symbolNeeded ifTrue: ['expected "symbol"'] ifFalse: ['expected "string"']). 
  742.     ^#()!
  743. parseText: aText
  744.     "Returns an array containing the text objects with symbols #nil, #true, and #false translated to the corresponding constants. If an error is detected, a message is generated and an empty array is returned. Note: later processing is unable to differentiate between symbols like '#hello' and variables like 'hello' because the evaluation step has eliminated the distinction."
  745.     | coding |
  746.     coding _ self evaluate: aText. 
  747.     coding isNil ifTrue: [^#()] ifFalse: [^coding "an Array"]!
  748. reportError: aString
  749.     self reportError: aString at: 1!
  750. reportError: aString at: position
  751.     messageView isNil ifTrue: [^self "can't report it"].
  752.     messageView controller insertAndSelect: aString at: position!
  753. translateConstants: anArray
  754.     | map |
  755.     map _ Dictionary new
  756.         at: #nil put: nil;
  757.         at: #true put: true;
  758.         at: #false put: false;
  759.         yourself.
  760.     ^anArray collect: [:element | map at: element ifAbsent: [element]]! !
  761. "-- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- "!
  762.  
  763. WindowMakerIcon class
  764.     instanceVariableNames: ''!
  765.  
  766. !WindowMakerIcon class methodsFor: 'instance creation'!
  767. new
  768.     ^super new computeLabel! !
  769.  
  770.  
  771. WindowMakerIcon subclass: #WindowMakerExternalIcon
  772.     instanceVariableNames: ''
  773.     classVariableNames: ''
  774.     poolDictionaries: ''
  775.     category: 'WindowMaker'!
  776.  
  777. !WindowMakerExternalIcon methodsFor: 'instance initialization'!
  778. initialize
  779.     super initialize.
  780.     defaultLabelSelector _ #getView!
  781. initializeMessages
  782.     super initializeMessages.
  783.     self 
  784.         addMessage: #comment default: #defaultComment
  785.             parser: #parseComment: coding: nil;
  786.         addMessage: #getView default: #defaultGetView
  787.             parser: #parseClassMessage: coding: #(ExtendedView getView)! !
  788.  
  789. !WindowMakerExternalIcon methodsFor: 'encoding/decoding'!
  790. decodeFrom: aStream
  791.     "iconClass iconName window insideColor borderWidth getViewMessage"
  792.  
  793.     super decodeFrom: aStream.
  794.     self changeMessage: #getView receiverSelectorArguments: aStream next!
  795. encodeOn: aStream
  796.     "iconClass iconName window insideColor borderWidth getViewMessage"
  797.  
  798.     super encodeOn: aStream.
  799.     aStream space; store: (self codingFor: #getView)! !
  800.  
  801. !WindowMakerExternalIcon methodsFor: 'generating views'!
  802. asView
  803.     ^ExtendedExternalView new
  804.         model: nil;
  805.         name: (self receiverFor: #name);
  806.         insideColor: insideColor;
  807.         borderWidthLeft: borderWidth left right: borderWidth right 
  808.             top: borderWidth top bottom: borderWidth bottom;
  809.         window: window;
  810.         transformation: transformation;
  811.         external: (self receiverSelectorArgumentsFor: #getView);
  812.         yourself! !
  813.  
  814. !WindowMakerExternalIcon methodsFor: 'interface window defaults'!
  815. defaultComment
  816.     ^Text
  817.         string: '
  818. An external window is used to reference and obtain a previously constructed extended view. This extended view replaces the external window at open time. An external window references its extended view via one message:
  819.  
  820.     (1)    getView to obtain an extended view.
  821.  
  822. An extended view may constructed in the WindowMaker by specifying that it be a subview (as opposed to a top view) in the external interface for the master window.'
  823.         runs: (RunArray
  824.             runs: #(4 15 405 )
  825.             values: #(1 2 1 ))!
  826. defaultGetView
  827.     ^Text
  828.         string: '
  829.     Object getView
  830.  
  831. "other examples:
  832.     FormLibrarian subView
  833.     Object getView: #blueButton version: 2
  834.  
  835. comment: Permits an externally constructed extended view to be integrated with the current view. The extended view replaces this external view at open time.
  836.  
  837. restrictions: The receiver must be a class name. Any number of constant parameters can be specified; nil, true, and false are permitted. An extended view must be returned. 
  838.  
  839. constructing extended views: An extended view can be constructed by the window maker by specifying a subview (as opposed to top view) in the interface at the top level (master window); i.e., by not selecting any icons, choosing the external interface entry in the yellow pop-up menu, and setting the topView option to false."'
  840.         runs: (RunArray
  841.             runs: #(19 14 66 7 151 12 25 10 54 3 2 4 6 5 19 13 21 27 298 )
  842.             values: #(1 2 1 2 1 2 1 2 1 2 1 2 1 2 1 2 1 2 1 ))! !
  843.  
  844. Smalltalk garbageCollect!
  845.  
  846. WindowMakerIcon subclass: #WindowMakerGroupIcon
  847.     instanceVariableNames: 'librarianForBackground width height leftRightAlignment upDownAlignment horizontalAbutment verticalAbutment '
  848.     classVariableNames: ''
  849.     poolDictionaries: ''
  850.     category: 'WindowMaker'!
  851.  
  852. !WindowMakerGroupIcon methodsFor: 'instance initialization'!
  853. group: aCollection
  854.     | box |
  855.     box _ aCollection first displayBox.
  856.     aCollection do: [:icon | box _ box merge: icon displayBox. self addSubView: icon].
  857.     box _ box expandBy: borderWidth.
  858.     self window: box viewport: box!
  859. initialize
  860.     super initialize.
  861.     self borderWidth: 4; borderColor: Form gray; insideColor: nil. "override"
  862.     width _ height _ 
  863.     leftRightAlignment _ upDownAlignment _ 
  864.     horizontalAbutment _ verticalAbutment _ #unchanged!
  865. temporaryGroup: aCollection
  866.     | box |
  867.     box _ aCollection first displayBox.
  868.     aCollection do: [:icon | box _ box merge: icon displayBox].
  869.     box _ box expandBy: borderWidth.
  870.     subViews _ aCollection. "Doesn't remove elements from their superview."
  871.     self window: box viewport: box! !
  872.  
  873. !WindowMakerGroupIcon methodsFor: 'encoding/decoding'!
  874. decodeFrom: aStream
  875.     "iconClass iconName window insideColor borderWidth (encodedIcon1 encodedIcon2 ...)"
  876.  
  877.     super decodeFrom: aStream.
  878.     aStream next do: [:anItem | self addSubView: (WindowMaker decode: anItem)]!
  879. encodeOn: aStream
  880.     "iconClass iconName window insideColor borderWidth (encodedIcon1 encodedIcon2 ...)"
  881.  
  882.     super encodeOn: aStream.
  883.     aStream
  884.         nextPutAll: ' ('.
  885.             subViews do: [:icon | WindowMaker encode: icon on: aStream. aStream space].
  886.             subViews isEmpty ifFalse: [aStream skip: -1]. aStream 
  887.         nextPut: $)! !
  888.  
  889. !WindowMakerGroupIcon methodsFor: 'generating views'!
  890. asView
  891.     self error: 'sender should have used groupDo:'! !
  892.  
  893. !WindowMakerGroupIcon methodsFor: 'group sequencing'!
  894. groupDo: aBlock
  895.     subViews do: [:icon | icon groupDo: aBlock]!
  896. groupGet: aBlock ifUnequal: unequalBlock
  897.     | firstTime result |
  898.     firstTime _ true. result _ nil.
  899.     self groupDo: [:icon |
  900.         firstTime 
  901.             ifTrue: [result _ aBlock value: icon. firstTime _ false] 
  902.             ifFalse: [result = (aBlock value: icon) ifFalse: [^unequalBlock value]]].
  903.     ^result!
  904. isolatedGroupMember
  905.     | count answer |
  906.     count _ 0.
  907.     self groupDo: [:icon | count _ count+1. answer _ icon].
  908.     count = 1 ifFalse: [self error: 'expected isolated icon'].
  909.     ^answer! !
  910.  
  911. !WindowMakerGroupIcon methodsFor: 'moving/growing primitives'!
  912. growTo: aPoint
  913.     "Parameter aPoint is in display coordinates."
  914.     | oldBox scale newBox delta |
  915.     oldBox _ self displayBox.
  916.     scale _ aPoint / oldBox extent.
  917.     subViews do: [:icon | icon scaleBy: scale].
  918.     newBox _ self displayBox.
  919.     delta _ oldBox origin - newBox origin. "bring back to old origin"
  920.     delta = (0@0) ifFalse: [subViews do: [:icon | icon moveBy: delta]]!
  921. moveBy: aPoint
  922.     "Parameter aPoint is in display coordinates."
  923.     self groupDo: [:icon | icon moveBy: aPoint]!
  924. scaleBy: scale
  925.     subViews do: [:icon | icon scaleBy: scale]! !
  926.  
  927. !WindowMakerGroupIcon methodsFor: 'displaying'!
  928. displayBox
  929.     | box |
  930.     box _ nil.
  931.     self groupDo: [:icon | 
  932.         box _ box isNil
  933.             ifTrue: [icon displayBox]
  934.             ifFalse: [box merge: icon displayBox]].
  935.     ^box!
  936. displayOn: aForm at: aPoint clippingBox: aRectangle rule: ruleInteger mask: maskForm
  937.     | offset |
  938.     offset _ self displayBox origin.
  939.     subViews do: [:icon |
  940.         icon displayOn: aForm at: icon displayBox origin - offset + aPoint 
  941.             clippingBox: aRectangle rule: ruleInteger mask: maskForm].
  942.     super displayOn: aForm at: aPoint clippingBox: aRectangle rule: ruleInteger mask: maskForm! !
  943.  
  944. !WindowMakerGroupIcon methodsFor: 'generic window messages'!
  945. acceptCancelYellowButtonMenu
  946.     ^ActionMenu
  947.         labels: 'accept\cancel' withCRs
  948.         lines: #()
  949.         selectors: #(accept cancel)! !
  950.  
  951. !WindowMakerGroupIcon methodsFor: 'generic window support (general)'!
  952. changeRequestFrom: aView
  953.     ^true! !
  954.  
  955. !WindowMakerGroupIcon methodsFor: 'generic window support (pre-opening/post-closing)'!
  956. postCloseAlignment: anExtendedStandardSystemView
  957.     "Make the alignment specification permanent if not cancelled. USED by Group."
  958.     anExtendedStandardSystemView controller cancelled ifFalse: [
  959.         self adjustWidths; adjustHeights.
  960.         self adjustLeftRightAlignment; adjustUpDownAlignment.
  961.         self adjustHorizontalAbutment; adjustVerticalAbutment]!
  962. postCloseBackground: anExtendedStandardSystemView
  963.     "USED by Switch, Picture, and SwitchAndPicture."
  964.     self librarianForBackground removeDependent: self!
  965. postCloseMakeMethod: anExtendedStandardSystemView
  966.     "Make the method if not cancelled. USED by Master."
  967.  
  968.     | masterIcon className category methodName class time overflowCategory |
  969.  
  970.     "Is it cancelled?"
  971.     anExtendedStandardSystemView controller cancelled ifTrue: [^self].
  972.  
  973.     "No, output it."
  974.     masterIcon _ self isolatedGroupMember.
  975.     (masterIcon outputOptionAt: #destination) == #transcript
  976.         ifTrue: [
  977.             Transcript 
  978.                 cr; nextPutAll: (
  979.                     (masterIcon outputOptionAt: #encoding) == #encoded
  980.                         ifTrue: [WindowMaker encode: masterIcon]
  981.                         ifFalse: [masterIcon asView storeString]);
  982.                 show: ' '. ^self].
  983.  
  984.     className _ (masterIcon outputOptionAt: #methodClass) asSymbol.
  985.     category _ masterIcon outputOptionAt: #methodCategory.
  986.     methodName _ (masterIcon outputOptionAt: #methodName) asSymbol.
  987.     overflowCategory _ masterIcon outputOptionAt: #overflowCategory.
  988.     class _ Smalltalk at: className 
  989.         ifAbsent: [^self error: 'class ', className, ' does not exist. Proceed to cancel'].
  990.     (masterIcon outputOptionAt: #destination) == #classMethod
  991.         ifTrue: [class _ class class].
  992.     
  993.     Transcript tab; show: 'Compiling Window ', methodName, ' ....'.
  994.     time _ WindowMakerMasterIconController timeFor: [
  995.         (masterIcon outputOptionAt: #encoding) == #encoded
  996.             ifTrue: [
  997.                 ExtendedStandardSystemView compileEncoding: masterIcon asView 
  998.                     intoClass: class method: methodName category: category]
  999.             ifFalse: [
  1000.                 masterIcon asView 
  1001.                     compileIntoClass: class method: methodName 
  1002.                     category: category overflow: overflowCategory]].
  1003.     Transcript show:' done in ', time, '.'; cr!
  1004. preOpenBackground: anExtendedStandardSystemView
  1005.     "USED by Switch, Picture, and SwitchAndPicture."
  1006.     | librarian path librarianView |
  1007.     librarian _ FormLibrarian new. self librarianForBackground: librarian.
  1008.     librarianView _ anExtendedStandardSystemView viewNamed: #librarian.
  1009.     librarianView resetModels; models: librarian.
  1010.     librarian addDependent: self. "handled by special update: method in WindowMakerGroup"
  1011.     path _ subViews first pictureFormPathName.
  1012.     (subViews detect: [:icon | icon pictureFormPathName ~= path] ifNone: [nil]) isNil
  1013.         ifTrue: [librarian selectedPathName: path]!
  1014. preOpenInterface: anExtendedStandardSystemView
  1015.     "USED by External, Menu, Picture, Switch, Text, and Master."
  1016.     | icon |
  1017.     icon _ self isolatedGroupMember.
  1018.     icon messageView: (anExtendedStandardSystemView viewNamed: #messageSource)! !
  1019.  
  1020. !WindowMakerGroupIcon methodsFor: 'interface window messages'!
  1021. acceptPermanently
  1022.     "Replace the appropriate messageInitializer method with revised text."
  1023.     | icon iconMessage handler newText methodName containerClass methodCategory code |
  1024.  
  1025.     "First, accept the changes."
  1026.     icon _ self isolatedGroupMember. iconMessage _ icon message.
  1027.     (handler _ icon messageView controller) textHasChanged ifTrue: [
  1028.         handler accept.
  1029.         handler textHasChanged ifTrue: [^self "not accepted; an error was detected"]].
  1030.  
  1031.     "Next, create a method with the changes."
  1032.     newText _ icon messageSources at: iconMessage.
  1033.     methodName _ icon messageInitializers at: iconMessage.
  1034.     containerClass _ icon class whichClassIncludesSelector: methodName.
  1035.     containerClass isNil ifTrue: [^self error: 'where is method ', methodName].
  1036.     methodCategory _ containerClass whichCategoryIncludesSelector: methodName.
  1037.  
  1038.     "Format the text construction part of the code better than the standard storeString."
  1039.     code _ WriteStream on: (String new: 1000).
  1040.     code 
  1041.         nextPutAll: methodName; crtab;
  1042.         nextPutAll: '^Text'; crtab: 2;
  1043.             nextPutAll: 'string: '; store: newText string; crtab: 2;
  1044.             nextPutAll: 'runs: (RunArray'; crtab: 3;
  1045.                 nextPutAll: 'runs: '; store: newText runs runs; crtab: 3;
  1046.                 nextPutAll: 'values: '; store: newText runs values; nextPut: $).
  1047.  
  1048.     containerClass compile: code contents classified: methodCategory!
  1049. isMessage: aSymbol
  1050.     | icon |
  1051.     icon _ self isolatedGroupMember.
  1052.     ^icon message == aSymbol!
  1053. message: aSymbol
  1054.     "Changes the message to aSymbol if possible; otherwise, flashes."
  1055.     | icon view |
  1056.     icon _ self isolatedGroupMember.
  1057.     icon message == aSymbol ifTrue: [^self "already as requested"].
  1058.     (view _ icon messageView) controller textHasChanged 
  1059.         ifTrue: [view flash. ^self "can't do it"] 
  1060.         ifFalse: [
  1061.             icon message: aSymbol.
  1062.             self changed: #message; changed: #messageSource]!
  1063. messageMenu
  1064.     ^ActionMenu
  1065.         labels: 'again\undo\copy\cut\paste\accept\cancel\reset\accept permanently' withCRs
  1066.         lines: #(2 5 8)
  1067.         selectors: #(again undo copySelection cut paste accept cancel resetSource acceptPermanently)!
  1068. messageSource
  1069.     | icon |
  1070.     icon _ self isolatedGroupMember.
  1071.     ^(icon messageSources at: icon message) copy!
  1072. messageSource: aText
  1073.     "Parses the given text (if possible) and creates the corresponding coded version."
  1074.     | icon iconMessage coding |
  1075.     icon _ self isolatedGroupMember. iconMessage _ icon message.
  1076.     coding _ icon parseText: aText forMessage: iconMessage.
  1077.     coding isEmpty ifTrue: [^false].
  1078.     icon messageCodings at: iconMessage put: coding.
  1079.     icon messageSources at: iconMessage put: aText copy.
  1080.     iconMessage == defaultLabelSelector ifTrue: [icon computeLabel].
  1081.     ^true!
  1082. resetSource
  1083.     | icon iconMessage aText |
  1084.     icon _ self isolatedGroupMember. iconMessage _ icon message.
  1085.     aText _ icon perform: (icon messageInitializers at: iconMessage).
  1086.     icon messageSources at: message put: aText.
  1087.     icon messageCodings at: message put: (icon parseText: aText forMessage: iconMessage).
  1088.     self changed: #messageSource! !
  1089.  
  1090. !WindowMakerGroupIcon methodsFor: 'alignment window messages'!
  1091. isHeight: aSymbol
  1092.     ^height == aSymbol!
  1093. isHorizontalAbutment: aSymbol
  1094.     ^horizontalAbutment == aSymbol!
  1095. isLeftRightAlignment: aSymbol
  1096.     ^leftRightAlignment == aSymbol!
  1097. isUpDownAlignment: aSymbol
  1098.     ^upDownAlignment == aSymbol!
  1099. isVerticalAbutment: aSymbol
  1100.     ^verticalAbutment == aSymbol!
  1101. isWidth: aSymbol
  1102.     ^width == aSymbol!
  1103. makeHeight: aSymbol
  1104.     height _ aSymbol.
  1105.     self changed: #height!
  1106. makeHorizontalAbutment: aSymbol
  1107.     horizontalAbutment _ aSymbol.
  1108.     self changed: #horizontalAbutment!
  1109. makeLeftRightAlignment: aSymbol
  1110.     leftRightAlignment _ aSymbol.
  1111.     self changed: #leftRightAlignment!
  1112. makeUpDownAlignment: aSymbol
  1113.     upDownAlignment _ aSymbol.
  1114.     self changed: #upDownAlignment!
  1115. makeVerticalAbutment: aSymbol
  1116.     verticalAbutment _ aSymbol.
  1117.     self changed: #verticalAbutment!
  1118. makeWidth: aSymbol
  1119.     width _ aSymbol.
  1120.     self changed: #width! !
  1121.  
  1122. !WindowMakerGroupIcon methodsFor: 'alignment window support'!
  1123. adjustHeights
  1124.     "Adjust the heights of all icons in the group - height options: unchanged, minimum, maximum."
  1125.     | operation newHeight |
  1126.     height == #unchanged ifTrue: [^self].
  1127.  
  1128.     operation _ #(min: max:) at: (#(minimum maximum) indexOf: height).
  1129.  
  1130.     newHeight _ subViews first displayBox height.
  1131.     subViews do: [:icon | 
  1132.         newHeight _ newHeight perform: operation with: icon displayBox height].
  1133.  
  1134.     subViews do: [:icon | icon changeHeight: newHeight].!
  1135. adjustHorizontalAbutment
  1136.     "Adjust the horizontal abutment of all icons in the group - horizontalAbutment options: unchanged, touching, leastSeparation, mostSeparation."
  1137.     | newGroup firstIcon firstRightSide secondIcon secondLeftSide minimumSeparation maximumSeparation newLeftSide newSeparation separation |
  1138.     horizontalAbutment == #unchanged ifTrue: [^self].
  1139.  
  1140.     "First, sort horizontally."
  1141.     newGroup _ (subViews asSortedCollection: [:a :b |
  1142.         (a displayBox origin x < b displayBox origin x) or: [
  1143.         (a displayBox origin x = b displayBox origin x) and: [
  1144.         (a displayBox corner x <= b displayBox corner x)]]]) asArray.
  1145.  
  1146.     "Second, determine the minimum and maximum separations between icons."
  1147.     firstIcon _ newGroup at: 1. firstRightSide _ firstIcon displayBox corner x.
  1148.     secondIcon _ newGroup at: 2. secondLeftSide _ secondIcon displayBox origin x.
  1149.     minimumSeparation _ maximumSeparation _ secondLeftSide - firstRightSide.
  1150.  
  1151.     (newGroup copyFrom: 3 to: newGroup size)
  1152.         inject: secondIcon displayBox corner x into: [:lastRightSide :icon |
  1153.             newLeftSide _ icon displayBox origin x.
  1154.             newSeparation _ newLeftSide - lastRightSide.
  1155.             minimumSeparation _ minimumSeparation min: newSeparation.
  1156.             maximumSeparation _ maximumSeparation max: newSeparation.
  1157.             icon displayBox corner x].
  1158.  
  1159.     "Watch out for overlapping icons."
  1160.     minimumSeparation _ minimumSeparation max: 0.
  1161.     maximumSeparation _ maximumSeparation max: 0.
  1162.  
  1163.     "Third, determine the separation to use."
  1164.     separation _ (Array with: 0 with: minimumSeparation with: maximumSeparation)
  1165.         at: (#(touching leastSeparation mostSeparation) indexOf: horizontalAbutment).
  1166.  
  1167.     "Fourth, make the changes."
  1168.     (newGroup copyFrom: 2 to: newGroup size)
  1169.         inject: firstRightSide into: [:lastRightSide :icon |
  1170.             icon moveTo: (lastRightSide+separation)@(icon displayBox origin y).
  1171.             icon displayBox corner x]!
  1172. adjustLeftRightAlignment
  1173.     "Adjust the left/right alignment of all icons in the group - makeLeftRightAlignment options: unchanged, leftSides, middles, rightSides."
  1174.     | index operation newX maxMin |
  1175.     leftRightAlignment == #unchanged ifTrue: [^self].
  1176.  
  1177.     index _ #(leftSides middles rightSides) indexOf: leftRightAlignment.
  1178.     operation _ #(origin center corner) at: index.
  1179.     maxMin _ #(min: min: max:) at: index.
  1180.  
  1181.     newX _ (subViews first displayBox perform: operation) x.
  1182.     subViews do: [:icon | newX _ newX perform: maxMin with: (icon displayBox perform: operation) x].
  1183.  
  1184.     operation _ #(changeLeftSide: changeMiddleHorizontally: changeRightSide:) at: index.
  1185.     subViews do: [:icon | icon perform: operation with: newX]!
  1186. adjustUpDownAlignment
  1187.     "Adjust the up/down alignment of all icons in the group - makeUpDownAlignment options: unchanged, tops, middles, bottoms."
  1188.     | index operation newY maxMin |
  1189.     upDownAlignment == #unchanged ifTrue: [^self].
  1190.  
  1191.     index _ #(tops middles bottoms) indexOf: upDownAlignment.
  1192.     operation _ #(origin center corner) at: index.
  1193.     maxMin _ #(min: min: max:) at: index.
  1194.  
  1195.     newY _ (subViews first displayBox perform: operation) y.
  1196.     subViews do: [:icon | newY _ newY perform: maxMin with: (icon displayBox perform: operation) y].
  1197.  
  1198.     operation _ #(changeTop: changeMiddleVertically: changeBottom:) at: index.
  1199.     subViews do: [:icon | icon perform: operation with: newY]!
  1200. adjustVerticalAbutment
  1201.     "Adjust the vertical abutment of all icons in the group - verticalAbutment options: unchanged, touching, leastSeparation, mostSeparation."
  1202.     | newGroup firstIcon firstBottom secondIcon secondTop minimumSeparation maximumSeparation newTop newSeparation separation |
  1203.     verticalAbutment == #unchanged ifTrue: [^self].
  1204.  
  1205.     "First, sort vertically."
  1206.     newGroup _ (subViews asSortedCollection: [:a :b |
  1207.         (a displayBox origin y < b displayBox origin y) or: [
  1208.         (a displayBox origin y = b displayBox origin y) and: [
  1209.         (a displayBox corner y <= b displayBox corner y)]]]) asArray.
  1210.  
  1211.     "Second, determine the minimum and maximum separations between icons."
  1212.     firstIcon _ newGroup at: 1. firstBottom _ firstIcon displayBox corner y.
  1213.     secondIcon _ newGroup at: 2. secondTop _ secondIcon displayBox origin y.
  1214.     minimumSeparation _ maximumSeparation _ secondTop - firstBottom.
  1215.  
  1216.     (newGroup copyFrom: 3 to: newGroup size)
  1217.         inject: secondIcon displayBox corner y into: [:lastBottom :icon |
  1218.             newTop _ icon displayBox origin y.
  1219.             newSeparation _ newTop - lastBottom.
  1220.             minimumSeparation _ minimumSeparation min: newSeparation.
  1221.             maximumSeparation _ maximumSeparation max: newSeparation.
  1222.             icon displayBox corner y].
  1223.  
  1224.     "Watch out for overlapping icons."
  1225.     minimumSeparation _ minimumSeparation max: 0.
  1226.     maximumSeparation _ maximumSeparation max: 0.
  1227.  
  1228.     "Third, determine the separation to use."
  1229.     separation _ (Array with: 0 with: minimumSeparation with: maximumSeparation)
  1230.         at: (#(touching leastSeparation mostSeparation) indexOf: verticalAbutment).
  1231.  
  1232.     "Fourth, make the changes."
  1233.     (newGroup copyFrom: 2 to: newGroup size)
  1234.         inject: firstBottom into: [:lastBottom :icon |
  1235.             icon moveTo: (icon displayBox origin x)@(lastBottom+separation).
  1236.             icon displayBox corner y]!
  1237. adjustWidths
  1238.     "Adjust the widths of all icons in the group - width options: unchanged, minimum, maximum."
  1239.     | operation newWidth |
  1240.     width == #unchanged ifTrue: [^self].
  1241.  
  1242.     operation _ #(min: max:) at: (#(minimum maximum) indexOf: width).
  1243.  
  1244.     newWidth _ subViews first displayBox width.
  1245.     subViews do: [:icon | 
  1246.         newWidth _ newWidth perform: operation with: icon displayBox width].
  1247.  
  1248.     subViews do: [:icon | icon changeWidth: newWidth]! !
  1249.  
  1250. !WindowMakerGroupIcon methodsFor: 'border window messages'!
  1251. changeBordersMenuSelection: aStringOrNil
  1252.     | border |
  1253.     aStringOrNil isNil ifTrue: [^self].
  1254.     border _ (aStringOrNil at: 1) digitValue.
  1255.     self groupDo: [:icon | icon borderWidth: border].
  1256.     self changed: #border!
  1257. changeBottomThickness: aText
  1258.     ^self privateChangeThickness: #bottom: from: aText!
  1259. changeLeftThickness: aText
  1260.     ^self privateChangeThickness: #left: from: aText!
  1261. changeRightThickness: aText
  1262.     ^self privateChangeThickness: #right: from: aText!
  1263. changeTopThickness: aText
  1264.     ^self privateChangeThickness: #top: from: aText!
  1265. getBordersMenuList
  1266.     ^(0 to: 8) collect: [:index | index printString, ' point']!
  1267. getBordersMenuSelection
  1268.     | border |
  1269.     border _ self groupGet: [:icon | icon borderWidth] ifUnequal: [^nil].
  1270.     border = ((0@0 extent: 0@0) translateBy: border left) ifFalse: [^nil].
  1271.     ^border left printString, ' point'!
  1272. getBottomThickness
  1273.     ^self privateGetThickness: #bottom!
  1274. getLeftThickness
  1275.     ^self privateGetThickness: #left!
  1276. getRightThickness
  1277.     ^self privateGetThickness: #right!
  1278. getTopThickness
  1279.     ^self privateGetThickness: #top!
  1280. privateChangeThickness: sideSymbol from: aText
  1281.     | result |
  1282.     result _ Compiler evaluate: aText.
  1283.     (result isKindOf: Integer) ifFalse: [^false].
  1284.     self groupDo: [:icon | icon borderWidth perform: sideSymbol with: result].
  1285.     self changed: #border.
  1286.     ^true!
  1287. privateGetThickness: sideSymbol
  1288.     ^(self groupGet: [:icon | icon borderWidth perform: sideSymbol] ifUnequal: [^Text new]) printString asText! !
  1289.  
  1290. !WindowMakerGroupIcon methodsFor: 'color window messages'!
  1291. isInsideColor: aColorSymbol
  1292.     | actualColor |
  1293.     actualColor _ aColorSymbol isNil ifTrue: [nil] ifFalse: [self decodeColor: aColorSymbol].
  1294.     self groupDo: [:icon | (icon insideColor == actualColor) ifFalse: [^false]].
  1295.     ^true!
  1296. makeInsideColor: aColorSymbol
  1297.     | actualColor |
  1298.     actualColor _ aColorSymbol isNil ifTrue: [nil] ifFalse: [self decodeColor: aColorSymbol].
  1299.     self groupDo: [:icon | icon insideColor: actualColor].
  1300.     self changed: #color! !
  1301.  
  1302. !WindowMakerGroupIcon methodsFor: 'background window messages'!
  1303. changeFixedPointEncoding: aSymbol
  1304.     self groupDo: [:icon | icon perform: aSymbol].
  1305.     self changed: #fixedPoint!
  1306. changeLockedSizeExpansion: aText
  1307.     | integer |
  1308.     integer _ Number readFrom: (ReadStream on: aText asString).
  1309.     self groupDo: [:icon | icon lockedSizeExpansion: integer; computeLabel].
  1310.     ^true!
  1311. changeLocking: aBoolean
  1312.     aBoolean
  1313.         ifTrue: [
  1314.             self groupDo: [:icon | icon sizeLocked: true; mode: #constant; computeLabel].
  1315.             self changed: #mode; changed: #locking]
  1316.         ifFalse: [
  1317.             self groupDo: [:icon | icon sizeLocked: false].
  1318.             self changed: #locking]!
  1319. changeMode: aSymbol
  1320.     aSymbol == #varying
  1321.         ifTrue: [
  1322.             self groupDo: [:icon | icon sizeLocked: false; mode: #varying].
  1323.             self changed: #mode; changed: #locking]
  1324.         ifFalse: [
  1325.             self groupDo: [:icon | icon mode: #constant].
  1326.             self changed: #mode]!
  1327. changePictureString: aText
  1328.     | aString |
  1329.     aString _ aText asString.
  1330.     self groupDo: [:icon | icon pictureString: aString; computeLabel].
  1331.     ^true!
  1332. changePictureVariety: aSymbol
  1333.     self groupDo: [:icon | icon pictureVariety: aSymbol; computeLabel].
  1334.     self changed: #pictureVariety!
  1335. getLockedSizeExpansion
  1336.     ^(self groupGet: [:icon | icon lockedSizeExpansion] ifUnequal: [^Text new]) printString asText!
  1337. getPictureString
  1338.     ^(self groupGet: [:icon | icon pictureString] ifUnequal: [^Text new]) asText!
  1339. isFixedPointEncoding: aSymbol
  1340.     self groupDo: [:icon | icon fixedPointEncoding == aSymbol ifFalse: [^false]].
  1341.     ^true!
  1342. isLocking: aBoolean
  1343.     self groupDo: [:icon | icon sizeLocked == aBoolean ifFalse: [^false]].
  1344.     ^true!
  1345. isMode: aSymbol
  1346.     self groupDo: [:icon | icon mode == aSymbol ifFalse: [^false]].
  1347.     ^true!
  1348. isPictureVariety: aSymbol
  1349.     self groupDo: [:icon | icon pictureVariety == aSymbol ifFalse: [^false]].
  1350.     ^true! !
  1351.  
  1352. !WindowMakerGroupIcon methodsFor: 'background window support'!
  1353. computeLabel
  1354.     "There is no label for a group icon."
  1355.     self label: nil!
  1356. librarianForBackground
  1357.     ^librarianForBackground!
  1358. librarianForBackground: aLibrarian
  1359.     librarianForBackground _ aLibrarian!
  1360. update: aSymbol
  1361.     "Provide the connection from switches and pictures to the librarian view. See method preOpenBackground: in WindowMakerGroupIcon."
  1362.     | path |
  1363.     aSymbol == #pictures
  1364.         ifTrue: [
  1365.             (path _ librarianForBackground selectedPathName) isNil
  1366.                 ifFalse: [subViews do: [:icon | icon pictureFormPathName: path; computeLabel]]]
  1367.         ifFalse: [super update: aSymbol]! !
  1368.  
  1369. !WindowMakerGroupIcon methodsFor: 'master sizing window messages'!
  1370. changeMaximumSize: aText
  1371.     | result |
  1372.     result _ Compiler evaluate: aText.
  1373.     (result isKindOf: Point) ifFalse: [^false].
  1374.     self groupDo: [:icon | icon maximumSize: result].
  1375.     ^true!
  1376. changeMinimumSize: aText
  1377.     | result |
  1378.     result _ Compiler evaluate: aText.
  1379.     (result isKindOf: Point) ifFalse: [^false].
  1380.     self groupDo: [:icon | icon minimumSize: result].
  1381.     ^true!
  1382. getMaximumSize
  1383.     self groupDo: [:icon | ^icon maximumSize printString asText]!
  1384. getMinimumSize
  1385.     self groupDo: [:icon | ^icon minimumSize printString asText]!
  1386. setSize: aSymbol
  1387.     "aSymbol is either #minimum or #maximum."
  1388.     self groupDo: [:icon | 
  1389.         icon perform: (aSymbol, 'Size:') asSymbol with: Rectangle fromUser extent].
  1390.     self changed: #sizing! !
  1391.  
  1392. !WindowMakerGroupIcon methodsFor: 'method window messages'!
  1393. outputOptionAt: index is: aSymbol
  1394.     | icon |
  1395.     icon _ self isolatedGroupMember.
  1396.     ^(icon outputOptionAt: index) == aSymbol!
  1397. outputOptionPutText: aText at: index
  1398.     | data icon |
  1399.     data _ (index == #methodCategory) | (index == #overflowCategory)
  1400.         ifTrue: [aText asString] 
  1401.         ifFalse: [aText asString asSymbol].
  1402.     icon _ self isolatedGroupMember.
  1403.     icon outputOptionAt: index put: data.
  1404.     self changed: #outputOption.
  1405.     ^true!
  1406. outputOptionTextAt: index
  1407.     | icon |
  1408.     icon _ self isolatedGroupMember.
  1409.     ^(icon outputOptionAt: index) asText! !
  1410.  
  1411. Smalltalk garbageCollect!
  1412.  
  1413. WindowMakerIcon subclass: #WindowMakerMasterIcon
  1414.     instanceVariableNames: 'selections minimumSize maximumSize outputOption '
  1415.     classVariableNames: ''
  1416.     poolDictionaries: ''
  1417.     category: 'WindowMaker'!
  1418.  
  1419. !WindowMakerMasterIcon methodsFor: 'instance initialization'!
  1420. initialize
  1421.     super initialize.
  1422.     window _ Display boundingBox. "minimize transformation roundoff errors."
  1423.     selections _ OrderedCollection new.
  1424.  
  1425.     minimumSize _ 50@50.
  1426.     maximumSize _ Display boundingBox extent.
  1427.  
  1428.     outputOption _ #(transcript "versus instanceMethod versus classMethod"
  1429.         encoded "versus notEncoded"
  1430.         aClassName aCategoryString aMethodName anOverFlowCategoryString) copy!
  1431. initializeMessages
  1432.     super initializeMessages.
  1433.     self
  1434.         addMessage: #comment default: #defaultComment
  1435.             parser: #parseComment: coding: nil;
  1436.         addMessage: #topView default: #defaultTopView
  1437.             parser: #parseBoolean: coding: #(true);
  1438.         addMessage: #title default: #defaultTitle
  1439.             parser: #parseNilOrString: coding: #(nil);
  1440.         addMessage: #preOpeningSelector default: #defaultPreOpeningSelector
  1441.             parser: #parseNilOrZeroOrMoreParameterMessage: coding: #(nil);
  1442.         addMessage: #postClosingSelector default: #defaultPostClosingSelector
  1443.             parser: #parseNilOrZeroOrMoreParameterMessage: coding: #(nil)!
  1444. makeIcon: anIconClass
  1445.     "Creates a new icon and keeps it if the user positions it inside the view."
  1446.     | center icon aForm offset position aRectangle |
  1447.  
  1448.     "Deselect all icons and make an icon at the current cursor point; set up initial information."
  1449.     center _ Sensor cursorPoint. self deselectAll. 
  1450.     self addSubView: (icon _ anIconClass new).
  1451.  
  1452.     "First draw the icon onto a form."
  1453.     aForm _ Form extent: icon displayBox extent.
  1454.     icon displayOn: aForm at: 0@0 clippingBox: aForm boundingBox rule: Form over mask: Form black.
  1455.  
  1456.     "Next, make it follow the cursor until it is depressed."
  1457.     offset _ aForm extent // 2.
  1458.     aForm
  1459.         follow: [position _ Sensor cursorPoint - offset]
  1460.         while: [Sensor redButtonPressed not].
  1461.  
  1462.     "Make the new icon permanent only if it is inside the window maker view."
  1463.     aRectangle _ position extent: aForm extent.
  1464.     (self insetDisplayBox contains: aRectangle)
  1465.         ifTrue: ["Make it permanent."
  1466.             icon moveTo: position.
  1467.             aForm displayAt: position.
  1468.             self select: icon]
  1469.         ifFalse: ["Make it go back into the switch."
  1470.             self removeSubView: icon.
  1471.             aForm slideFrom: position to: center-offset steps: 20]! !
  1472.  
  1473. !WindowMakerMasterIcon methodsFor: 'encoding/decoding'!
  1474. decodeFrom: aStream
  1475.     "iconClass iconName window insideColor borderWidth transformation topView title preOpeningSelector postClosingSelector minimumSize maximumSize outputOption (encodedIcon1 encodedIcon2 ...)"
  1476.  
  1477.     super decodeFrom: aStream.
  1478.     self
  1479.         transformation: (self decodeTransformation: aStream next);
  1480.         changeMessage: #topView receiver: aStream next;
  1481.         changeMessage: #title receiver: aStream next;
  1482.         changeMessage: #preOpeningSelector selectorArguments: aStream next;
  1483.         changeMessage: #postClosingSelector selectorArguments: aStream next.
  1484.     minimumSize _ self decodePoint: aStream next.
  1485.     maximumSize _ self decodePoint: aStream next.
  1486.     outputOption _ aStream next.
  1487.     aStream next do: [:anItem | self addSubView: (WindowMaker decode: anItem)]!
  1488. decodeTransformation: anArray
  1489.     "decode #(<scale x> <scale y> <translation x> <translation y>)"
  1490.     ^WindowingTransformation
  1491.         scale: (anArray at: 1)@(anArray at: 2)
  1492.         translation: (anArray at: 3)@(anArray at: 4)!
  1493. encodeOn: aStream
  1494.     "iconClass iconName window insideColor borderWidth transformation topView title preOpeningSelector postClosingSelector minimumSize maximumSize outputOption (encodedIcon1 encodedIcon2 ...)"
  1495.  
  1496.     super encodeOn: aStream.
  1497.     aStream
  1498.         space. self encodeTransformationOn: aStream. aStream
  1499.         nextPutAll: ' "topView" '; store: (self receiverFor: #topView);
  1500.         nextPutAll: ' "title" '; store: (self receiverFor: #title);
  1501.         nextPutAll: ' "preOpening" '; store: (self codingWithoutReceiverFor: #preOpeningSelector);
  1502.         nextPutAll: ' "postClosing" '; store: (self codingWithoutReceiverFor: #postClosingSelector);
  1503.         space. self encodePoint: minimumSize on: aStream. aStream 
  1504.         space. self encodePoint: maximumSize on: aStream. aStream
  1505.         space; store: outputOption;
  1506.         nextPutAll: ' ('.
  1507.             subViews do: [:icon | WindowMaker encode: icon on: aStream. aStream space].
  1508.             subViews isEmpty ifFalse: [aStream skip: -1]. aStream 
  1509.         nextPut: $)!
  1510. encodeTransformationOn: aStream
  1511.     "encode as #(<scale x> <scale y> <translation x> <translation y>)"
  1512.     aStream print: (Array 
  1513.         with: transformation scale x with: transformation scale y 
  1514.         with: transformation translation x with: transformation translation y).! !
  1515.  
  1516. !WindowMakerMasterIcon methodsFor: 'generating views'!
  1517. asView
  1518.     | aView |
  1519.     aView _ (self receiverFor: #topView)
  1520.         ifFalse: [ExtendedView new]
  1521.         ifTrue: [ExtendedStandardSystemView new
  1522.             preOpeningSelector: (self selectorArgumentsFor: #preOpeningSelector);
  1523.             postClosingSelector: (self selectorArgumentsFor: #postClosingSelector);
  1524.             label: (self receiverFor: #title);
  1525.             minimumSize: minimumSize;
  1526.             maximumSize: maximumSize;
  1527.             yourself].
  1528.  
  1529.     aView encoding: (Compiler evaluate: (WindowMaker encode: self)).
  1530.  
  1531.     aView
  1532.         model: nil;
  1533.         name: (self receiverFor: #name);
  1534.         insideColor: insideColor;
  1535.         borderWidthLeft: borderWidth left right: borderWidth right 
  1536.             top: borderWidth top bottom: borderWidth bottom;
  1537.         window: window;
  1538.         transformation: transformation;
  1539.         yourself.
  1540.  
  1541.     "Eliminate all groups."
  1542.     subViews do: [:subView | subView groupDo: [:icon | aView addSubView: icon asView]].
  1543.  
  1544.     ^aView! !
  1545.  
  1546. !WindowMakerMasterIcon methodsFor: 'copying'!
  1547. shallowCopy
  1548.     ^super shallowCopy
  1549.         outputOption: self outputOption deepCopy! !
  1550.  
  1551. !WindowMakerMasterIcon methodsFor: 'zooming'!
  1552. scaleBy: scale
  1553.     "Since this view does not scale, scale the subviews."
  1554.     subViews do: [:anIcon | anIcon scaleBy: scale]!
  1555. zoomIn
  1556.     self scaleBy: 1.1@1.1.
  1557.     self displayView!
  1558. zoomOut
  1559.     self scaleBy: 0.9@0.9.
  1560.     self displayView! !
  1561.  
  1562. !WindowMakerMasterIcon methodsFor: 'displaying'!
  1563. computeDisplayTransformation
  1564.     "Ensure that (1) this view does not scale and (2) the window center maps to the display box center. One solution is to ensure that the window center is 0@0 and the same as the display box; a side-benefit is that the sub-icons need never be moved since they are always positioned in a window that appears to be fixed."
  1565.     | box |
  1566.     "First, compute the normal way (need the display box) and then change it."
  1567.     displayTransformation _ superView displayTransformation compose: transformation.
  1568.     box _ self displayBox.
  1569.     window _ box copy moveTo: 0@0 - (box extent // 2).
  1570.     viewport _ superView inverseDisplayTransform: box.
  1571.     transformation _ WindowingTransformation 
  1572.         window: window viewport: viewport.
  1573.     displayTransformation _ WindowingTransformation 
  1574.         scale: nil translation: (box origin - window origin).    
  1575.     ^displayTransformation!
  1576. display
  1577.     self displayView!
  1578. displayView
  1579.     "Creates a form with the existing icons and then displays the form. This prevents the user from seeing the icons individually displayed one after the other."
  1580.     | displayArea extent canvas offset canvasDisplayArea labelDisplayBox |
  1581.  
  1582.     self isUnlocked ifTrue: [self lock].
  1583.     displayArea _ self displayBox. offset _ displayArea origin. extent _ displayArea extent. 
  1584.     canvas _ Form extent: extent. 
  1585.     canvasDisplayArea _ (0@0 extent: extent) insetBy: self borderWidth.
  1586.  
  1587.     Cursor normal showWhile: [
  1588.         canvas black; fill: canvasDisplayArea mask: insideColor. 
  1589.         subViews do: [:icon | 
  1590.             icon displayOn: canvas 
  1591.                 at: icon displayBox origin - offset clippingBox: canvasDisplayArea 
  1592.                 rule: Form under mask: Form black].
  1593.         selections do: [:icon | 
  1594.             icon highlightOn: canvas 
  1595.                 at: icon displayBox origin - offset clippingBox: canvasDisplayArea]].
  1596.  
  1597.     canvas displayOn: Display at: offset.! !
  1598.  
  1599. !WindowMakerMasterIcon methodsFor: 'selections'!
  1600. clearSelections
  1601.     selections _ OrderedCollection new!
  1602. deselect: icon
  1603.     selections remove: icon. icon dehighlight.!
  1604. deselectAll
  1605.     [selections size = 0] whileFalse: [selections removeFirst dehighlight].!
  1606. select: icon
  1607.     selections add: icon. icon highlight.!
  1608. selections
  1609.     ^selections!
  1610. ungroupedSelections
  1611.     | ungroupedSelections |
  1612.     ungroupedSelections _ OrderedCollection new. 
  1613.     selections do: [:selection | 
  1614.         selection groupDo: [:icon | ungroupedSelections add: icon]].
  1615.     ^ungroupedSelections! !
  1616.  
  1617. !WindowMakerMasterIcon methodsFor: 'controller'!
  1618. defaultControllerClass 
  1619.     ^WindowMakerMasterIconController!
  1620. subViewWantingControl
  1621.     "This is handled by redButtonActivity."
  1622.     ^nil! !
  1623.  
  1624. !WindowMakerMasterIcon methodsFor: 'background'!
  1625. computeLabel
  1626.     "There is no label for the master icon."
  1627.     self label: nil! !
  1628.  
  1629. !WindowMakerMasterIcon methodsFor: 'interface window defaults'!
  1630. defaultComment
  1631.     ^Text
  1632.         string: '
  1633. A master window is a window that contains all the subwindows obtained from the window maker. A method can be generated that produces the corresponding view. Two varieties exist:
  1634.  
  1635.     (1)    an extended standard system view (a standalone top view).
  1636.     (2)    an extended view (a subview).
  1637.  
  1638. Either one of these can incorporate a separately generated subview by constructing an external window that references it. At open time, such external windows are replaced by the corresponding extended view. See external windows for more details.
  1639.  
  1640. options: The topView option specifies whether a top view or subview is desired. The title, preOpen, and postOpen options apply only to top views. The title provides the tab at the top of the window (e.g., ''Master Window Interface'' for this window); a nil title implies no tab at all. The preOpen and postClose options (when not nil) are messages sent to the model immediately before the window is opened and immediately after it is closed respectively.
  1641.  
  1642. opening windows: A top window is opened by providing either an encoding of the window which is compact or an extended standard system view which is lengthy but much faster. The method construction option gives you a choice of the two. In either case, the window maker uses this view or creates one if necessary and distributes the model to all subviews. A preOpen message (if it exists) is then sent to the model.
  1643.  
  1644.     WindowMaker open: encodedWindowOrView on: aModel
  1645.  
  1646. preOpen and postClose messages: These messages permit the model to find and store (by name) subviews useful for the application and to redistribute (or change) the models associated with them. The preOpen and postClose messages include the extended systandard system view as a parameter. A preOpen message might be used (1) to record, for example, an error message subwindow called ''error'' for later use (assuming such a window was part of the master window) or (2) to initialize some of the subwindows with models other than itself; this might be needed for setting up the model for an external window. A postClose message might be used to perform final post-processing; e.g., if a window provides alignment options, closing the window might be the signal to actually perform the alignment. An example preOpen method is
  1647.  
  1648.     preOpen: anExtendedStandardSystemView
  1649.         | librarian librarianView |
  1650.         librarian _ FormLibrarian new.
  1651.         librarianView _ anExtendedStandardSystemView viewNamed: #librarianView.
  1652.         librarianView resetModels; models: librarian.
  1653.  
  1654. Method viewNamed: retrieves the subview with the specified name. Method models: recursively replaces nil models by the parameter for all subviews; non-nil models are unmodified and stop the recursion. Method resetModels recursively sets all non-nil models to nil in the same way.'
  1655.         runs: (RunArray
  1656.             runs: #(3 13 172 29 34 13 101 8 153 7 6 7 130 5 133 7 5 10 144 15 413 4 22 2 10 30 557 8 225 40 59 3 49 9 34 11 2 6 21 9 56 6 130 11 60 )
  1657.             values: #(1 2 1 2 1 2 1 2 1 2 1 2 1 2 1 2 1 2 1 2 1 2 1 2 1 2 1 2 1 2 1 2 1 2 1 2 1 2 1 2 1 2 1 2 1 ))!
  1658. defaultPostClosingSelector
  1659.     ^Text
  1660.         string: '
  1661.     model postClose: #anExtendedStandardSystemView
  1662.  
  1663. "other examples:
  1664.     nil
  1665.     model finalize: #anExtendedStandardSystemView
  1666.     model closeup: #anExtendedStandardSystemView forPane: 2
  1667.  
  1668. comment: The post-close message (if not nil) is sent to the model immediately after the window (view) is closed. The view replaces the first parameter.
  1669.  
  1670. restrictions: For non-nil messages, the receiver must be ''model''. One or more constant parameters can be specified; nil, true, and false are permitted. The result returned is not used."'
  1671.         runs: (RunArray
  1672.             runs: #(8 9 34 14 14 8 39 7 32 7 5 7 5 11 17 3 110 12 104 3 2 4 6 5 49 )
  1673.             values: #(1 2 1 2 1 2 1 2 1 2 1 2 1 2 1 2 1 2 1 2 1 2 1 2 1 ))!
  1674. defaultPreOpeningSelector
  1675.     ^Text
  1676.         string: '
  1677.     model preOpen: #anExtendedStandardSystemView
  1678.  
  1679. "other examples:
  1680.     nil
  1681.     model preInitialize: #anExtendedStandardSystemView
  1682.     model setup: #anExtendedStandardSystemView forPane: 2
  1683.  
  1684. comment: The pre-open message (if not nil) is sent to the model immediately before the window (view) is opened. The view replaces the first parameter.
  1685.  
  1686. restrictions: For non-nil messages, the receiver must be ''model''. One or more constant parameters can be specified; nil, true, and false are permitted. The result returned is not used."'
  1687.         runs: (RunArray
  1688.             runs: #(8 7 34 14 14 13 39 5 32 7 5 7 5 9 17 3 111 12 104 3 2 4 6 5 49 )
  1689.             values: #(1 2 1 2 1 2 1 2 1 2 1 2 1 2 1 2 1 2 1 2 1 2 1 2 1 ))!
  1690. defaultTitle
  1691.     ^Text
  1692.         string: '
  1693.     ''Application Window''
  1694.  
  1695. "other examples:
  1696.     nil
  1697.     ''Top Window Interface Options''
  1698.  
  1699. comment: The title provides the tab at the top of the window; a nil title implies no tab at all.
  1700.  
  1701. restrictrions: Only a string or nil is permitted."'
  1702.         runs: (RunArray
  1703.             runs: #(25 14 40 7 6 5 80 13 37 )
  1704.             values: #(1 2 1 2 1 2 1 2 1 ))!
  1705. defaultTopView
  1706.     ^Text
  1707.         string: '
  1708.     true
  1709.  
  1710. "other examples:
  1711.     false
  1712.  
  1713. comment: Specifies whether or not this master window is a top view.
  1714.  
  1715.     (1)    true => an extended standard system view (it can be used as a top view).
  1716.     (2)    false => an extended view (it can be used as a subview via an external window)."'
  1717.         runs: (RunArray
  1718.             runs: #(9 14 10 7 78 29 50 13 37 8 10 )
  1719.             values: #(1 2 1 2 1 2 1 2 1 2 1 ))! !
  1720.  
  1721. !WindowMakerMasterIcon methodsFor: 'master sizing window support'!
  1722. maximumSize
  1723.     ^maximumSize!
  1724. maximumSize: aPoint
  1725.     maximumSize _ aPoint!
  1726. minimumSize
  1727.     ^minimumSize!
  1728. minimumSize: aPoint
  1729.     minimumSize _ aPoint! !
  1730.  
  1731. !WindowMakerMasterIcon methodsFor: 'method window support'!
  1732. outputOption
  1733.     ^outputOption!
  1734. outputOption: anArray
  1735.     outputOption _ anArray!
  1736. outputOptionAt: aSymbol
  1737.     ^outputOption 
  1738.         at: (#(destination encoding methodClass methodCategory 
  1739.             methodName overflowCategory) indexOf: aSymbol)!
  1740. outputOptionAt: aSymbol put: anObject
  1741.     outputOption 
  1742.         at: (#(destination encoding methodClass methodCategory 
  1743.             methodName overflowCategory) indexOf: aSymbol) 
  1744.         put: anObject! !
  1745.  
  1746.  
  1747. MouseMenuController subclass: #WindowMakerMasterIconController
  1748.     instanceVariableNames: 'previousPopUpWindow '
  1749.     classVariableNames: 'IconCopyBuffer '
  1750.     poolDictionaries: ''
  1751.     category: 'WindowMaker'!
  1752.  
  1753. !WindowMakerMasterIconController methodsFor: 'controlling'!
  1754. controlActivity
  1755.     super controlActivity.
  1756.     self processKeyboard!
  1757. controlInitialize
  1758.     ^view displayView!
  1759. processKeyboard
  1760.     "Determine whether the user pressed the keyboard. If so, read the keys."
  1761.     [sensor keyboardPressed] whileTrue: [self dispatchOnCharacter: sensor keyboard].!
  1762. redButtonActivity
  1763.     [sensor redButtonPressed] whileTrue: [self processSelections]!
  1764. yellowButtonActivity
  1765.     "Determine which menu items are permitted in this context and provide only those to the user via a pop-up menu."
  1766.  
  1767.     | selections ungroupedSelections labels lines selectors selectionsAllSwitchesOrPictures index atLeastOneSwitchAndPicture |
  1768.  
  1769.     "Refuse to permit two pop-up windows."
  1770.     previousPopUpWindow isNil ifFalse: [
  1771.         (PopUpMenu 
  1772.             labels: 'cancel previously active pop-up window'
  1773.             lines: #()) startUp ~= 0 
  1774.             ifTrue: [self cancelPopUpWindow]].
  1775.  
  1776.     selections _ view selections. ungroupedSelections _ view ungroupedSelections.
  1777.     labels _ OrderedCollection new. lines _ OrderedCollection new. 
  1778.     selectors _ OrderedCollection new.
  1779.  
  1780.     "The <delete, copy, cut, paste> entries."
  1781.     selections size > 0
  1782.         ifTrue: [
  1783.             labels addAll: #('delete' 'copy (@c)' 'cut (@x)').
  1784.             selectors addAll: #(processCharacterDelete processCharacterCopy 
  1785.                 processCharacterCut)].
  1786.     labels add: 'paste (@v)'. selectors add: #processCharacterPaste. lines add: labels size.
  1787.  
  1788.     "The <group, ungroup> entries."
  1789.     selections size > 0
  1790.         ifTrue: [
  1791.             labels addAll: #('group (@g)' 'ungroup (@u)'). 
  1792.             selectors addAll: #(processCharacterGroup processCharacterUngroup). 
  1793.             lines add: labels size].
  1794.  
  1795.     "The <icon visual adjustment> entries."
  1796.     selections size > 1
  1797.         ifTrue: [labels add: 'align'. selectors add: #align].
  1798.  
  1799.     labels add: 'border/color'. selectors add: #borderAndColor.
  1800.  
  1801.     selectionsAllSwitchesOrPictures _ (ungroupedSelections 
  1802.         detect: [:anIcon | (anIcon isKindOf: WindowMakerSwitchOrPictureIcon) not]
  1803.         ifNone: [nil]) isNil.
  1804.     (selections size > 0) & selectionsAllSwitchesOrPictures
  1805.         ifTrue: [
  1806.             labels add: 'background'. 
  1807.             atLeastOneSwitchAndPicture _ (ungroupedSelections 
  1808.                 detect: [:anIcon | anIcon isKindOf: WindowMakerSwitchAndPictureIcon]
  1809.                 ifNone: [nil]) notNil.
  1810.             atLeastOneSwitchAndPicture
  1811.                 ifTrue: [selectors add: #switchAndPictureBackground]
  1812.                 ifFalse: [selectors add: #background]].
  1813.  
  1814.     selections size <= 1
  1815.         ifTrue: [labels add: 'external interface'. selectors add: #interface].
  1816.  
  1817.     selections size = 0
  1818.         ifTrue: [labels add: 'set minimum and maximum size'. selectors add: #setSize].
  1819.  
  1820.     self combinableSwitchAndPicture
  1821.         ifTrue: [
  1822.             labels add: 'combine switch and picture'. 
  1823.             selectors add: #combineSwitchAndPicture].
  1824.  
  1825.     lines add: labels size.
  1826.  
  1827.     "The <editor adjustment> entries."
  1828.  
  1829.     labels addAll: #('move all into view' 'envelope icons' 'expand a bit' 'shrink a bit').
  1830.     selectors addAll: #(show envelope grow shrink).
  1831.     lines add: selectors size.
  1832.  
  1833.     "The <window output and help> entries."
  1834.  
  1835.     labels addAll: #('make method' 'help'). selectors addAll: #(makeMethod help).
  1836.  
  1837.     "Ask the user for a selection."
  1838.     labels _ labels inject: '' into: [:result :selector |
  1839.         result isEmpty 
  1840.             ifTrue: [selector] 
  1841.             ifFalse: [result, (String with: Character cr), selector]].
  1842.     index _ (PopUpMenu labels: labels lines: lines) startUp.
  1843.     index ~= 0 ifTrue: [self perform: (selectors at: index)]! !
  1844.  
  1845. !WindowMakerMasterIconController methodsFor: 'menu messages (options windows)'!
  1846. align
  1847.     self popUpWithCancel: #alignment onGroup: view selections!
  1848. background
  1849.     self popUpWithoutCancel: #background onGroup: view ungroupedSelections!
  1850. borderAndColor
  1851.     | selections |
  1852.     (selections _ view ungroupedSelections) isEmpty ifTrue: [selections _ Array with: view].
  1853.     self popUpWithoutCancel: #borderingAndColoring onGroup: selections!
  1854. interface
  1855.     "Warning: only individual icons are handled."
  1856.     | selections name selection |
  1857.     (selections _ view selections) isEmpty ifTrue: [selections _ Array with: view].
  1858.     selections size > 1 ifTrue: [self error: 'Implementation oversight'].
  1859.     selection _ selections first.
  1860.     name _ selection shortClassName asLowercase. "??? in WindowMaker???Icon"
  1861.     self popUpWithoutCancel: name onGroup: selections!
  1862. makeMethod
  1863.     self popUpWithCancel: #makeMethod onGroup: (OrderedCollection with: view)!
  1864. setSize
  1865.     self popUpWithoutCancel: #masterSizing onGroup: (OrderedCollection with: view)!
  1866. switchAndPictureBackground
  1867.     self popUpWithoutCancel: #switchAndPictureBackground onGroup: view ungroupedSelections! !
  1868.  
  1869. !WindowMakerMasterIconController methodsFor: 'menu messages (no options windows)'!
  1870. cancelPopUpWindow
  1871.     "In case it cannot be closed, pretend it did."
  1872.     | save |
  1873.     save _ previousPopUpWindow.
  1874.     self forgetPopUpWindow.
  1875.     ScheduledControllers unschedule: save controller.
  1876.     save release.
  1877.     ScheduledControllers restore!
  1878. combineSwitchAndPicture
  1879.     | switch picture combined border box |
  1880.     switch _ view selections 
  1881.         detect: [:icon | icon isMemberOf: WindowMakerSwitchIcon].
  1882.     picture _ view selections 
  1883.         detect: [:icon | icon isMemberOf: WindowMakerPictureIcon].
  1884.  
  1885.     combined _ WindowMakerSwitchAndPictureIcon new
  1886.         name: switch name;
  1887.         transformation: switch transformation;
  1888.         window: switch window;
  1889.         insideColor: switch insideColor;
  1890.         borderWidthLeft: (border _ switch borderWidth) left 
  1891.             right: border right top: border top bottom: border bottom;
  1892.         
  1893.         pictureFormPathName: (switch encodedPictureData copyFrom: 2 to: 3);
  1894.         lockedSizeExpansion: switch lockedSizeExpansion;
  1895.         changeMessage: #updateSymbol receiver: (switch receiverFor: #updateSymbol);
  1896.         changeMessage: #isOn selectorArguments: (switch codingWithoutReceiverFor: #isOn);
  1897.         changeMessage: #switch selectorArguments: (switch codingWithoutReceiverFor: #switch);
  1898.         pictureString: picture pictureString;
  1899.         fixMiddleLeft.
  1900.  
  1901.     box _ switch getWindow merge: picture getWindow.
  1902.     combined getWindow origin: box origin; corner: box corner.
  1903.     combined computeLabel.
  1904.  
  1905.     view removeSubView: switch; removeSubView: picture; addSubView: combined.
  1906.     view selections remove: switch; remove: picture; add: combined.
  1907.     combined unlock; lock.
  1908.     view displayView!
  1909. envelope
  1910.     "Make the view exactly contain the existing subviews."
  1911.  
  1912.     | subViews newDisplayBox offset superDisplayBox |
  1913.  
  1914.     subViews _ view subViews.
  1915.     subViews size = 0 ifTrue: [view flash. ^self].
  1916.  
  1917.     "The new display box must contain all subviews and the border."
  1918.     newDisplayBox _ (subViews inject: subViews first displayBox into: [:box :aView |
  1919.         box merge: aView displayBox]) expandBy: view borderWidth.
  1920.  
  1921.     "Moreover, the center of the new display box must be at the center of the view. This can be achieved only if the subviews are offset by the same amount."
  1922.     offset _ view displayBox center - newDisplayBox center.
  1923.     newDisplayBox moveBy: offset. "Move its center to the old one."
  1924.     subViews do: [:aView | aView moveBy: offset].
  1925.  
  1926.     "Change the display box for the top view."
  1927.     self resize: view displayBoxTo: newDisplayBox!
  1928. grow
  1929.     "Enlarge this view's display box by 10@10."
  1930.     self resize: view displayBoxTo: (view displayBox expandBy: 10)!
  1931. help
  1932.     self confirm: (
  1933.         'A detailed description of master windows can be obtained \',
  1934.         'by ensuring that nothing is selected and choosing the     \',
  1935.         'external interface entry in the yellow button pop-up       \',
  1936.         'menu. Similar descriptions for the other classes of windows\',
  1937.         'can be obtained by selecting one of these windows and    \',
  1938.         'choosing the same external interface entry.                   \',
  1939.         '\',
  1940.         'If no such window exists, one can be created by pressing  \',
  1941.         'one of the switches at the top. The new window that        \',
  1942.         'appears can be placed anywhere in the pane below          \',
  1943.         'the switches.                                                       ') withCRs!
  1944. show
  1945.     "Move all icons into the view to ensure their visibility."
  1946.     view subViews do: [:anIcon |
  1947.         anIcon displayBox extent > (10@10) ifFalse: [anIcon growTo: 10@10].
  1948.         anIcon moveBy: (anIcon displayBox amountToTranslateWithin: view displayBox)].
  1949.     view displayView!
  1950. shrink
  1951.     "Shrink this view's display box by 10@10."
  1952.     self resize: view displayBoxTo: (view displayBox insetBy: 10)! !
  1953.  
  1954. !WindowMakerMasterIconController methodsFor: 'menu messages support'!
  1955. combinableSwitchAndPicture
  1956.     | switch picture |
  1957.     ^view selections size = 2 and: [
  1958.     (switch _ view selections 
  1959.         detect: [:icon | icon isMemberOf: WindowMakerSwitchIcon] 
  1960.         ifNone: [nil]) notNil and: [
  1961.     (picture _ view selections 
  1962.         detect: [:icon | icon isMemberOf: WindowMakerPictureIcon] 
  1963.         ifNone: [nil]) notNil and: [
  1964.     switch pictureVariety == #form]]]!
  1965. forgetPopUpWindow
  1966.     previousPopUpWindow _ nil!
  1967. popUp: aView controller: aController on: aModel
  1968.     ((previousPopUpWindow _ aView) controller: aController; models: aModel) open!
  1969. popUpWithCancel: windowName onGroup: selections
  1970.     self 
  1971.         popUp: (WindowMakerMasterIconController windowFor: windowName) 
  1972.         controller: (WindowMakerControllerWithCancel withCancelFor: self) 
  1973.         on: (WindowMakerGroupIcon new temporaryGroup: selections)!
  1974. popUpWithCancel: windowName onIndividual: selection
  1975.     self 
  1976.         popUp: (WindowMakerMasterIconController windowFor: windowName) 
  1977.         controller: (WindowMakerControllerWithCancel withCancelFor: self) 
  1978.         on: selection!
  1979. popUpWithoutCancel: windowName onGroup: selections
  1980.     self 
  1981.         popUp: (WindowMakerMasterIconController windowFor: windowName) 
  1982.         controller: (WindowMakerControllerWithCancel withoutCancelFor: self) 
  1983.         on: (WindowMakerGroupIcon new temporaryGroup: selections)!
  1984. popUpWithoutCancel: windowName onIndividual: selection
  1985.     self 
  1986.         popUp: (WindowMakerMasterIconController windowFor: windowName) 
  1987.         controller: (WindowMakerControllerWithCancel withoutCancelFor: self) 
  1988.         on: selection!
  1989. resize: aView displayBoxTo: aViewDisplayBox
  1990.     "This is achieved by recursively computing the display boxes of all super views. It is physically changed for the top view."
  1991.     | currentView newDisplayBox | 
  1992.  
  1993.     "Determine the successive superview display boxes (remember the last)."
  1994.     currentView _ aView. newDisplayBox _ aViewDisplayBox.
  1995.     [currentView isTopView] whileFalse: [
  1996.         newDisplayBox _ self superViewDisplayBoxFrom: currentView and: newDisplayBox.
  1997.         currentView _ currentView superView].
  1998.  
  1999.     currentView window: currentView getWindow viewport: newDisplayBox.
  2000.  
  2001.     "Make the close box visible?"
  2002.     ((Display boundingBox insetBy: (Rectangle left: 0 right: 1 top: 1 bottom: 0))
  2003.         containsPoint: newDisplayBox origin) ifFalse: [
  2004.             currentView
  2005.                 align: currentView displayBox topLeft 
  2006.                 with: 0@currentView labelDisplayBox height].
  2007.  
  2008.     currentView lock; displayEmphasized!
  2009. superViewDisplayBoxFrom: aView and: aViewDisplayBox
  2010.     "Determines the superview's display box from a new (arbitrary) display box for the view. Note: if t maps this view's viewport to aViewDisplayBox, then t will also map the superview's window to its new display box."
  2011.     ^(WindowingTransformation window: aView getViewport viewport: aViewDisplayBox) "t"
  2012.          applyTo: aView superView getWindow! !
  2013.  
  2014. !WindowMakerMasterIconController methodsFor: 'character processing'!
  2015. dispatchOnCharacter: aCharacter
  2016.     "Carry out the action associated with this character."
  2017.  
  2018.     "ParcPlace Smalltalk equivalents."
  2019.     aCharacter = Character backspace ifTrue: [^self processCharacterDelete].
  2020.     aCharacter = (Character value: 3) "ctl c" ifTrue: [^self processCharacterCopy].
  2021.     aCharacter = (Character value: 24) "ctl x" ifTrue: [^self processCharacterCut].
  2022.     aCharacter = (Character value: 22) "ctl v" ifTrue: [^self processCharacterPaste].
  2023.     aCharacter = (Character value: 7) "ctl g" ifTrue: [^self processCharacterGroup].
  2024.     aCharacter = (Character value: 21) "ctl u" ifTrue: [^self processCharacterUngroup].
  2025.  
  2026.     "Apple Smalltalk equivalents.
  2027.     aCharacter = Character backspace ifTrue: [^self processCharacterDelete].
  2028.     aCharacter = (Character value: 3) ?ctl c? ifTrue: [^self processCharacterCopy].
  2029.     aCharacter = (Character value: 151) ?ctl x? ifTrue: [^self processCharacterCut].
  2030.     aCharacter = (Character value: 134) ?ctl v? ifTrue: [^self processCharacterPaste].
  2031.     aCharacter = (Character value: 231) ?ctl g? ifTrue: [^self processCharacterGroup].
  2032.     aCharacter = (Character value: 21) ?ctl u? ifTrue: [^self processCharacterUngroup]."
  2033.  
  2034.     "Ignore anything else"
  2035.  
  2036.     "To determine what character some control character is, uncomment the following code,
  2037.     open a WindowMaker editor, and type it."
  2038.     "Transcript cr; show: 'Ignored character ', aCharacter storeString, 
  2039.         ' <', aCharacter asInteger printString, '>'; cr"!
  2040. processCharacterCopy
  2041.     IconCopyBuffer _ view selections collect: [:icon | icon shallowCopy]!
  2042. processCharacterCut
  2043.     self processCharacterCopy; processCharacterDelete!
  2044. processCharacterDelete
  2045.     view selections do: [:icon | view removeSubView: icon].
  2046.     view clearSelections; displayView!
  2047. processCharacterGroup
  2048.     | group newIcon selections |
  2049.     selections _ view selections.
  2050.     selections size < 2 ifTrue: [^self]. "avoid grouping unnecessarily"
  2051.     selections do: [:icon | view removeSubView: icon].
  2052.     newIcon _ WindowMakerGroupIcon new group: selections.
  2053.     view clearSelections.
  2054.     view selections add: newIcon.
  2055.     view addSubView: newIcon; displayView!
  2056. processCharacterPaste
  2057.     | newIcon selections |
  2058.     IconCopyBuffer isNil ifTrue: [^self].
  2059.     view clearSelections. selections _ view selections.
  2060.     IconCopyBuffer do: [:icon |
  2061.         newIcon _ icon shallowCopy.
  2062.         view addSubView: newIcon. 
  2063.         selections add: newIcon.
  2064.         newIcon moveBy: 10@10].
  2065.     view displayView!
  2066. processCharacterUngroup
  2067.     | newSelections oldSelections |
  2068.     oldSelections _ view selections. view clearSelections. newSelections _ view selections.
  2069.     oldSelections do: [:icon |
  2070.         (icon isKindOf: WindowMakerGroupIcon)
  2071.             ifTrue: [
  2072.                 view removeSubView: icon.
  2073.                 icon subViews shallowCopy do: [:groupIcon |
  2074.                     view addSubView: groupIcon.
  2075.                     newSelections add: groupIcon]]
  2076.             ifFalse: [newSelections add: icon]].
  2077.     view displayView! !
  2078.  
  2079. !WindowMakerMasterIconController methodsFor: 'selection processing'!
  2080. adjustSelections: icon initialMousePoint: start
  2081.     "Deselect all other windows and adjust the size of this one."
  2082.     | startPoint draw endPoint |
  2083.     startPoint _ start.
  2084.     view deselectAll; select: icon.
  2085.     draw _ [icon reverseBoundary].
  2086.  
  2087.     draw value. "Draw initial selection boundaries." 
  2088.     [Sensor redButtonPressed] whileTrue: [
  2089.         endPoint _ Sensor mousePoint. 
  2090.         startPoint = endPoint ifFalse: [
  2091.             draw value. "Erase selection boundaries." 
  2092.             icon growBy: endPoint - startPoint.
  2093.             draw value. "Redraw selection boundaries."
  2094.             startPoint _ endPoint]].
  2095.     draw value. "Erase final selection boundaries." 
  2096.     view displayView!
  2097. moveOrAdjustSelections: icon initialMousePoint: start
  2098.     "If the mouse is on the grow box, deselect all other windows and adjust the size of this one; otherwise, move the selections."
  2099.  
  2100.     (icon growBoxContainsPoint: start)
  2101.         ifTrue: [self adjustSelections: icon initialMousePoint: start]
  2102.         ifFalse: [self moveSelectionsInitialMousePoint: start]!
  2103. moveSelectionsInitialMousePoint: start
  2104.     "Have the selections track the mouse as long as it is depressed."
  2105.     | startPoint draw endPoint displacement |
  2106.     startPoint _ start.
  2107.     draw _ [view selections do: [:icon | icon reverseBoundary]].
  2108.  
  2109.     draw value. "Draw initial selection boundaries." 
  2110.     [Sensor redButtonPressed] whileTrue: [
  2111.         endPoint _ Sensor mousePoint. 
  2112.         startPoint = endPoint ifFalse: [
  2113.             displacement _ endPoint - startPoint.
  2114.             draw value. "Erase selection boundaries." 
  2115.             view selections do: [:icon | icon moveBy: displacement].
  2116.             draw value. "Redraw selection boundaries."
  2117.             startPoint _ endPoint]].
  2118.     draw value. "Erase final selection boundaries." 
  2119.     view displayView!
  2120. processNoSelection
  2121.     "For choosing multiple selections, draw a rectangle that tracks the mouse. Drawing is achieved by repeatedly erasing the previous rectangle and redrawing the new. By using rule reverse for all drawing, we guarantee that all lines drawn can be undone."
  2122.  
  2123.     | startPosition endPosition draw borderRectangle newEndPosition |
  2124.     view deselectAll.
  2125.  
  2126.     startPosition _ Sensor cursorPoint. endPosition _ startPosition.
  2127.     draw _ [
  2128.         borderRectangle _ (startPosition min: endPosition) 
  2129.             corner: (startPosition max: endPosition).
  2130.         Display 
  2131.             border: borderRectangle 
  2132.             width: 2 rule: Form reverse mask: Form black].
  2133.  
  2134.     "Note: the first time a border is drawn, a no-op results because the borderRectangle is empty."
  2135.     [Sensor redButtonPressed] whileTrue: [
  2136.         newEndPosition _ Sensor cursorPoint.
  2137.         newEndPosition = endPosition ifFalse: [
  2138.             draw value. "Erase the old."
  2139.             endPosition _ newEndPosition. 
  2140.             draw value "Draw the new."]].
  2141.     draw value. "Erase the last borderRectangle"
  2142.     
  2143.     view subViews do: [:icon |
  2144.         (icon displayBox intersects: borderRectangle) ifTrue: [
  2145.             view select: icon]]!
  2146. processSelections
  2147.     "If the shift key is down, a new selection is added and an old selection is removed. If the shift key is up, new selections replace existing selections; old selections are moved. If nothing is selected, all old selections are removed."
  2148.     | selectionPoint |
  2149.     selectionPoint _ Sensor cursorPoint.
  2150.     view subViews do: [:icon |
  2151.         (icon containsPoint: selectionPoint) ifTrue: [
  2152.             Sensor leftShiftDown
  2153.                 ifTrue: [
  2154.                     (view selections includes: icon)
  2155.                         ifTrue: [view deselect: icon]
  2156.                         ifFalse: [view select: icon].
  2157.                     Sensor waitNoButton]
  2158.                 ifFalse: [
  2159.                     (view selections includes: icon) ifFalse: [view deselectAll; select: icon].
  2160.                     self moveOrAdjustSelections: icon initialMousePoint: selectionPoint].
  2161.             ^self]].
  2162.  
  2163.     self processNoSelection! !
  2164. "-- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- "!
  2165.  
  2166. WindowMakerMasterIconController class
  2167.     instanceVariableNames: ''!
  2168.  
  2169. !WindowMakerMasterIconController class methodsFor: 'class initialization'!
  2170. compress
  2171.     "WindowMakerMasterIconController compress"
  2172.     | time |
  2173.     Transcript cr; show: 'Compressing'.
  2174.     time _ WindowMakerMasterIconController timeFor: [
  2175.         #(alignment background borderingAndColoring makeMethod switchAndPictureBackground) do: [:part | 
  2176.             Transcript show: ' ', part, '.... '.
  2177.             ExtendedStandardSystemView 
  2178.                 compileEncoding: (WindowMakerMasterIconController windowFor: part) 
  2179.                 intoClass: WindowMakerMasterIconController class 
  2180.                 method: part, 'Window' category: 'generic windows'].
  2181.         #(external master masterSizing menu picture switch text) do: [:part | 
  2182.             Transcript show: ' ', part, '.... '.
  2183.             ExtendedStandardSystemView 
  2184.                 compileEncoding: (WindowMakerMasterIconController windowFor: part) 
  2185.                 intoClass: WindowMakerMasterIconController class 
  2186.                 method: part, 'Window' category: 'specific windows']].
  2187.     Transcript cr; show: 'Total time ', time, '.'; cr!
  2188. decompress
  2189.     "WindowMakerMasterIconController decompress"
  2190.     | time |
  2191.     Transcript cr.
  2192.     time _ WindowMakerMasterIconController timeFor: [
  2193.         #(alignment background borderingAndColoring makeMethod switchAndPictureBackground) do: [:part | 
  2194.             Smalltalk garbageCollect. "just in case"
  2195.             WindowMakerMasterIconController 
  2196.                 decodeAndCompile: part method: part, 'Window' category: 'generic windows'].
  2197.         #(external master masterSizing menu picture switch text) do: [:part |
  2198.             Smalltalk garbageCollect. "just in case" 
  2199.             WindowMakerMasterIconController 
  2200.                 decodeAndCompile: part method: part, 'Window' category: 'specific windows']].
  2201.     Transcript show: 'Total time ', time, '.'; cr! !
  2202.  
  2203. !WindowMakerMasterIconController class methodsFor: 'class initialization support'!
  2204. decodeAndCompile: aSymbol method: methodName category: categoryName
  2205.     "Explicitly re-encodes the view in case modifications to the encoding was done by hand."
  2206.  
  2207.     | time view |
  2208.     Transcript show: 'Decoding ', aSymbol, ' ....'.
  2209.     time _ self timeFor: [view _ WindowMaker asView: (self windowFor: aSymbol) encoding].
  2210.     Transcript show: ' done in ', time, '.'; cr.
  2211.  
  2212.     Transcript tab; show: 'Compiling ', aSymbol, ' ....'.
  2213.     time _ self timeFor: [
  2214.         view 
  2215.             compileIntoClass: WindowMakerMasterIconController class 
  2216.             method: methodName category: categoryName].
  2217.     Transcript show: ' done in ', time, '.'; cr.
  2218.     ^view!
  2219. timeFor: aBlock
  2220.     | time1 time2 difference minutes seconds |
  2221.     time1 _ Time now asSeconds.
  2222.     aBlock value.
  2223.     time2 _ Time now asSeconds.
  2224.     difference _ time2 - time1. 
  2225.     minutes _ difference // 60. seconds _ difference \\ 60.
  2226.     ^(minutes > 1 
  2227.         ifTrue: [minutes printString, ' minutes ']
  2228.         ifFalse: [minutes = 1
  2229.             ifTrue: ['1 minute ']
  2230.             ifFalse: ['']]),
  2231.     (seconds > 1 
  2232.         ifTrue: [seconds printString, ' seconds']
  2233.         ifFalse: [seconds = 1
  2234.             ifTrue: ['1 second']
  2235.             ifFalse: ['']])! !
  2236.  
  2237. !WindowMakerMasterIconController class methodsFor: 'windows'!
  2238. windowFor: aSymbol
  2239.     ^WindowMaker asView: (self perform: (aSymbol, 'Window') asSymbol)! !
  2240.  
  2241. !WindowMakerMasterIconController class methodsFor: 'generic windows'!
  2242. alignmentWindow
  2243.     "Returns an initialized view."
  2244.     | anArray |
  2245.  
  2246.     anArray _ "WindowMaker edit:" #(Master nil (-239 -167 239 167) white 1 (2.14644
  2247.         1.29816 512.0 264.208) true 'Alignment' (nil) (postCloseAlignment: anExtendedStandardSystemView)
  2248.         (350 180) (1000 1000) (classMethod notEncoded WindowMakerMasterIconController 'generic windows'
  2249.         alignmentWindow 'generic windows overflow') ((Picture nil (-228.0 -156.0
  2250.         -187.0 -141.0) white 0 (text 'widths:') (lockedConstant fixMiddleLeft 0)
  2251.         (nil (nil))) (Picture nil (-228.0 -102.0 -183.0 -87.0) white 0 (text 'heights:')
  2252.         (lockedConstant fixMiddleLeft 0) (nil (nil))) (Picture nil (-228.0 6.0 -111.0
  2253.         21.0) white 0 (text 'up/down alignment:') (lockedConstant fixMiddleLeft 0)
  2254.         (nil (nil))) (Picture nil (-228.0 -48.0 -110.0 -33.0) white 0 (text 'left/right alignment:')
  2255.         (lockedConstant fixMiddleLeft 0) (nil (nil))) (Picture nil (-228.0 60.0 -109.0
  2256.         75.0) white 0 (text 'horizontal abutment:') (lockedConstant fixMiddleLeft
  2257.         0) (nil (nil))) (Picture nil (-228.0 114.0 -124.0 129.0) white 0 (text 'vertical abutment:')
  2258.         (lockedConstant fixMiddleLeft 0) (nil (nil))) (Group nil (-205 -114 203 -91)
  2259.         nil 4 ((SwitchAndPicture nil (-209.0 -129.0 -120.0 -114.0) white 0 (form
  2260.         DefaultFormLibrary button separation 10 text 'unchanged') (lockedConstant
  2261.         fixMiddleLeft 0) (width (isWidth: unchanged) (makeWidth: unchanged))) (SwitchAndPicture
  2262.         nil (-103.0 -129.0 33.0 -114.0) white 0 (form DefaultFormLibrary button separation
  2263.         10 text 'all minimum width') (lockedConstant fixMiddleLeft 0) (width (isWidth:
  2264.         minimum) (makeWidth: minimum))) (SwitchAndPicture nil (55.0 -129.0 191.0
  2265.         -114.0) white 0 (form DefaultFormLibrary button separation 10 text 'all maximum width')
  2266.         (lockedConstant fixMiddleLeft 0) (width (isWidth: maximum) (makeWidth: maximum)))))
  2267.         (Group nil (-205 -68 207 -45) nil 4 ((SwitchAndPicture nil (-209.0 -75.0
  2268.         -120.0 -60.0) white 0 (form DefaultFormLibrary button separation 10 text
  2269.         'unchanged') (lockedConstant fixMiddleLeft 0) (height (isHeight: unchanged)
  2270.         (makeHeight: unchanged))) (SwitchAndPicture nil (-103.0 -75.0 37.0 -60.0)
  2271.         white 0 (form DefaultFormLibrary button separation 10 text 'all minimum height')
  2272.         (lockedConstant fixMiddleLeft 0) (height (isHeight: minimum) (makeHeight:
  2273.         minimum))) (SwitchAndPicture nil (55.0 -75.0 195.0 -60.0) white 0 (form DefaultFormLibrary
  2274.         button separation 10 text 'all maximum height') (lockedConstant fixMiddleLeft
  2275.         0) (height (isHeight: maximum) (makeHeight: maximum))))) (Group nil (-205
  2276.         -23 167 0) nil 4 ((SwitchAndPicture nil (-209.0 -21.0 -120.0 -6.0) white
  2277.         0 (form DefaultFormLibrary button separation 10 text 'unchanged') (lockedConstant
  2278.         fixMiddleLeft 0) (leftRightAlignment (isLeftRightAlignment: unchanged) (makeLeftRightAlignment:
  2279.         unchanged))) (SwitchAndPicture nil (-103.0 -21.0 -27.0 -6.0) white 0 (form
  2280.         DefaultFormLibrary button separation 10 text 'left sides') (lockedConstant
  2281.         fixMiddleLeft 0) (leftRightAlignment (isLeftRightAlignment: leftSides) (makeLeftRightAlignment:
  2282.         leftSides))) (SwitchAndPicture nil (-16.0 -21.0 52.0 -6.0) white 0 (form
  2283.         DefaultFormLibrary button separation 10 text 'middles') (lockedConstant fixMiddleLeft
  2284.         0) (leftRightAlignment (isLeftRightAlignment: middles) (makeLeftRightAlignment:
  2285.         middles))) (SwitchAndPicture nil (70.0 -21.0 155.0 -6.0) white 0 (form DefaultFormLibrary
  2286.         button separation 10 text 'right sides') (lockedConstant fixMiddleLeft 0)
  2287.         (leftRightAlignment (isLeftRightAlignment: rightSides) (makeLeftRightAlignment:
  2288.         rightSides))))) (Group nil (-205 20 149 43) nil 4 ((SwitchAndPicture nil
  2289.         (-209.0 33.0 -120.0 48.0) white 0 (form DefaultFormLibrary button separation
  2290.         10 text 'unchanged') (lockedConstant fixMiddleLeft 0) (upDownAlignment
  2291.         (isUpDownAlignment: unchanged) (makeUpDownAlignment: unchanged)))
  2292.         (SwitchAndPicture nil (-103.0 33.0 -56.0 48.0) white 0 (form DefaultFormLibrary
  2293.         button separation 10 text 'tops') (lockedConstant fixMiddleLeft 0) (upDownAlignment
  2294.         (isUpDownAlignment: tops) (makeUpDownAlignment: tops))) (SwitchAndPicture
  2295.         nil (-16.0 33.0 52.0 48.0) white 0 (form DefaultFormLibrary button separation
  2296.         10 text 'middles') (lockedConstant fixMiddleLeft 0) (upDownAlignment
  2297.         (isUpDownAlignment: middles) (makeUpDownAlignment: middles))) (SwitchAndPicture
  2298.         nil (70.0 33.0 137.0 48.0) white 0 (form DefaultFormLibrary button separation
  2299.         10 text 'bottoms') (lockedConstant fixMiddleLeft 0) (upDownAlignment
  2300.         (isUpDownAlignment: bottoms) (makeUpDownAlignment: bottoms))))) (Group
  2301.         nil (-205 66 240 89) nil 4 ((SwitchAndPicture nil (-209.0 87.0 -120.0 102.0)
  2302.         white 0 (form DefaultFormLibrary button separation 10 text 'unchanged') (lockedConstant
  2303.         fixMiddleLeft 0) (horizontalAbutment (isHorizontalAbutment: unchanged) (makeHorizontalAbutment:
  2304.         unchanged))) (SwitchAndPicture nil (-103.0 87.0 -27.0 102.0) white 0 (form
  2305.         DefaultFormLibrary button separation 10 text 'touching') (lockedConstant
  2306.         fixMiddleLeft 0) (horizontalAbutment (isHorizontalAbutment: touching) (makeHorizontalAbutment:
  2307.         touching))) (SwitchAndPicture nil (-7.0 87.0 105.0 102.0) white 0 (form DefaultFormLibrary
  2308.         button separation 10 text 'least separation') (lockedConstant fixMiddleLeft
  2309.         0) (horizontalAbutment (isHorizontalAbutment: leastSeparation) (makeHorizontalAbutment:
  2310.         leastSeparation))) (SwitchAndPicture nil (116.0 87.0 228.0 102.0) white 0
  2311.         (form DefaultFormLibrary button separation 10 text 'most separation') (lockedConstant
  2312.         fixMiddleLeft 0) (horizontalAbutment (isHorizontalAbutment: mostSeparation)
  2313.         (makeHorizontalAbutment: mostSeparation))))) (Group nil (-204 111 240 134)
  2314.         nil 4 ((SwitchAndPicture nil (-208.0 141.0 -119.0 156.0) white 0 (form DefaultFormLibrary
  2315.         button separation 10 text 'unchanged') (lockedConstant fixMiddleLeft 0) (verticalAbutment
  2316.         (isVerticalAbutment: unchanged) (makeVerticalAbutment: unchanged))) (SwitchAndPicture
  2317.         nil (-103.0 141.0 -27.0 156.0) white 0 (form DefaultFormLibrary button separation
  2318.         10 text 'touching') (lockedConstant fixMiddleLeft 0) (verticalAbutment (isVerticalAbutment:
  2319.         touching) (makeVerticalAbutment: touching))) (SwitchAndPicture nil (-7.0
  2320.         141.0 105.0 156.0) white 0 (form DefaultFormLibrary button separation 10
  2321.         text 'least separation') (lockedConstant fixMiddleLeft 0) (verticalAbutment
  2322.         (isVerticalAbutment: leastSeparation) (makeVerticalAbutment: leastSeparation)))
  2323.         (SwitchAndPicture nil (116.0 141.0 228.0 156.0) white 0 (form DefaultFormLibrary
  2324.         button separation 10 text 'most separation') (lockedConstant fixMiddleLeft
  2325.         0) (verticalAbutment (isVerticalAbutment: mostSeparation) (makeVerticalAbutment:
  2326.         mostSeparation))))))).
  2327.     ^anArray!
  2328. backgroundWindow
  2329.     "Returns an initialized view."
  2330.     | anArray |
  2331.  
  2332.     anArray _ "WindowMaker edit:" #(Master nil (-235 -192 236 192) white 1
  2333.         (1.35381 1.18038 319.323 228.065) true 'Background' (preOpenBackground:
  2334.         anExtendedStandardSystemView) (postCloseBackground: anExtendedStandardSystemView)
  2335.         (500 350) (1000 1000) (classMethod notEncoded WindowMakerMasterIconController 'generic windows'
  2336.         backgroundWindow 'generic windows overflow') ((Picture nil (-224.0 -181.0
  2337.         -147.0 -166.0) white 0 (text 'kind of switch:') (lockedConstant fixMiddleLeft
  2338.         0) (nil (nil))) (Picture nil (-224.0 6.0 -129.0 21.0) white 0 (text 'mode parameters:')
  2339.         (lockedConstant fixMiddleLeft 0) (nil (nil))) (Picture nil (-224.0 104.0
  2340.         -99.0 119.0) white 0 (text 'fixed point parameters:') (lockedConstant
  2341.         fixMiddleLeft 0) (nil (nil))) (SwitchAndPicture nil (-204.0 -107.0 -154.0
  2342.         -92.0) white 0 (form DefaultFormLibrary button separation 10 text 'form')
  2343.         (lockedConstant fixMiddleLeft 0) (pictureVariety (isPictureVariety: form)
  2344.         (changePictureVariety: form))) (SwitchAndPicture nil (-204.0 71 -115.0
  2345.         86) white 0 (form DefaultFormLibrary button separation 10 text 'varying size')
  2346.         (lockedConstant fixMiddleLeft 0) (mode (isMode: varying) (changeMode:
  2347.         varying))) (SwitchAndPicture nil (-48.0 50 22.0 65) white 0 (form DefaultFormLibrary
  2348.         button separation 10 text 'unlocked') (lockedConstant fixMiddleLeft 0)
  2349.         (locking (isLocking: false) (changeLocking: false))) (Group nil (-218
  2350.         121 137 144) nil 4 ((SwitchAndPicture nil (-204.0 128.0 -139.0 143.0)
  2351.         white 0 (form DefaultFormLibrary button separation 10 text 'top left')
  2352.         (lockedConstant fixMiddleLeft 0) (fixedPoint (isFixedPointEncoding: fixTopLeft)
  2353.         (changeFixedPointEncoding: fixTopLeft))) (SwitchAndPicture nil (68.0 128.0
  2354.         139.0 143.0) white 0 (form DefaultFormLibrary button separation 10 text
  2355.         'top right') (lockedConstant fixMiddleLeft 0) (fixedPoint (isFixedPointEncoding:
  2356.         fixTopRight) (changeFixedPointEncoding: fixTopRight))))) (Group nil (-218
  2357.         139 158 162) nil 4 ((SwitchAndPicture nil (-204.0 146.0 -123.0 161.0)
  2358.         white 0 (form DefaultFormLibrary button separation 10 text 'middle left')
  2359.         (lockedConstant fixMiddleLeft 0) (fixedPoint (isFixedPointEncoding: fixMiddleLeft)
  2360.         (changeFixedPointEncoding: fixMiddleLeft))) (SwitchAndPicture nil (-48.0
  2361.         146.0 11.0 161.0) white 0 (form DefaultFormLibrary button separation 10
  2362.         text 'center') (lockedConstant fixMiddleLeft 0) (fixedPoint (isFixedPointEncoding:
  2363.         fixCenter) (changeFixedPointEncoding: fixCenter))) (SwitchAndPicture nil
  2364.         (68.0 146.0 155.0 161.0) white 0 (form DefaultFormLibrary button separation
  2365.         10 text 'middle right') (lockedConstant fixMiddleLeft 0) (fixedPoint (isFixedPointEncoding:
  2366.         fixMiddleRight) (changeFixedPointEncoding: fixMiddleRight))))) (Group
  2367.         nil (-218 159 157 182) nil 4 ((SwitchAndPicture nil (-204.0 166.0 -119.0
  2368.         181.0) white 0 (form DefaultFormLibrary button separation 10 text 'bottom left')
  2369.         (lockedConstant fixMiddleLeft 0) (fixedPoint (isFixedPointEncoding: fixBottomLeft)
  2370.         (changeFixedPointEncoding: fixBottomLeft))) (SwitchAndPicture nil (68.0
  2371.         166.0 159.0 181.0) white 0 (form DefaultFormLibrary button separation
  2372.         10 text 'bottom right') (lockedConstant fixMiddleLeft 0) (fixedPoint (isFixedPointEncoding:
  2373.         fixBottomRight) (changeFixedPointEncoding: fixBottomRight))))) (Group
  2374.         nil (-218 23 198 50) nil 4 ((Picture nil (68 32 136 47) white 0 (text
  2375.         'extra border') (lockedConstant fixMiddleLeft 0) (nil (nil))) (Text nil
  2376.         (149.0 30.0 204.0 49.0) white 1 (nil (getLockedSizeExpansion) (changeLockedSizeExpansion:
  2377.         aText) (acceptCancelYellowButtonMenu))) (SwitchAndPicture nil (-204.0
  2378.         32.0 -110.0 47.0) white 0 (form DefaultFormLibrary button separation 10
  2379.         text 'constant size') (lockedConstant fixMiddleLeft 0) (mode (isMode:
  2380.         constant) (changeMode: constant))) (SwitchAndPicture nil (-48.0 32.0 10.0
  2381.         47.0) white 0 (form DefaultFormLibrary button separation 10 text 'locked')
  2382.         (lockedConstant fixMiddleLeft 0) (locking (isLocking: true) (changeLocking:
  2383.         true))))) (SwitchAndPicture nil (-204.0 -156.0 -156.0 -141.0) white 0
  2384.         (form DefaultFormLibrary button separation 10 text 'text') (lockedConstant
  2385.         fixMiddleLeft 0) (pictureVariety (isPictureVariety: text) (changePictureVariety:
  2386.         text))) (Group nil (-136 -162 229 5) nil 4 ((External nil (-132.0 -117.0
  2387.         225.0 1.0) nil 1 (FormLibrarian subView)) (Text nil (-132.0 -158.0 -4.0
  2388.         -138.0) white 1 (nil (getPictureString) (changePictureString: aText) (acceptCancelYellowButtonMenu))))))).
  2389.     ^anArray!
  2390. borderingAndColoringWindow
  2391.     "Returns an initialized view."
  2392.     | anArray |
  2393.  
  2394.     anArray _ "WindowMaker edit:" #(Master nil (-254 -129 255 130) white 1
  2395.         (2.01572 1.6749 510.992 263.263) true 'Bordering and Coloring' (nil) (nil)
  2396.         (350 180) (1000 1000) (classMethod notEncoded WindowMakerMasterIconController 'generic windows'
  2397.         borderingAndColoringWindow 'generic windows overflow') ((Group nil (-318
  2398.         -121 -27 124) nil 4 ((Picture nil (-139.0 -118.0 -65.0 -103.0) white 0
  2399.         (text 'border width') (constant fixMiddleLeft) (nil (nil))) (Group nil
  2400.         (-318 -65 -27 124) nil 4 ((Menu nil (-77.0 -62.0 40.0 119.0) white 1 (border
  2401.         (getBordersMenuList) (getBordersMenuSelection) (changeBordersMenuSelection:
  2402.         aSelectionObject) (nil))) (Group nil (-318 -58 -193 111) nil 4 ((Text
  2403.         nil (-161.0 -55.0 -126.0 -37.0) white 1 (border (getTopThickness) (changeTopThickness:
  2404.         aText) (acceptCancelYellowButtonMenu))) (Picture nil (-243.0 -53.0 -226.0
  2405.         -38.0) white 0 (text 'top') (constant fixCenter) (nil (nil))) (Picture
  2406.         nil (-243.0 88.0 -206.0 103.0) white 0 (text 'bottom') (constant fixCenter)
  2407.         (nil (nil))) (Picture nil (-243.0 41.0 -215.0 56.0) white 0 (text 'right')
  2408.         (constant fixCenter) (nil (nil))) (Picture nil (-243.0 -6.0 -224.0 9.0)
  2409.         white 0 (text 'left') (constant fixCenter) (nil (nil))) (Text nil (-161.0
  2410.         -6.0 -126.0 12.0) white 1 (border (getLeftThickness) (changeLeftThickness:
  2411.         aText) (acceptCancelYellowButtonMenu))) (Text nil (-161.0 41.0 -126.0
  2412.         59.0) white 1 (border (getRightThickness) (changeRightThickness: aText)
  2413.         (acceptCancelYellowButtonMenu))) (Text nil (-161.0 88.0 -126.0 106.0)
  2414.         white 1 (border (getBottomThickness) (changeBottomThickness: aText) (acceptCancelYellowButtonMenu)))))))))
  2415.         (Group nil (14 -121 177 124) nil 4 ((Picture nil (153.0 -118.0 180.0 -103.0)
  2416.         white 0 (text 'color') (constant fixMiddleLeft) (nil (nil))) (Group nil
  2417.         (85 -66 248 124) nil 4 ((Switch nil (127.0 -37.0 244.0 -11.0) white 1
  2418.         (text '') (varying) (color (isNil) (makeInsideColor: white))) (Switch
  2419.         nil (127.0 -11.0 244.0 15.0) veryLightGray 1 (text '') (varying) (color
  2420.         (isNil) (makeInsideColor: veryLightGray))) (Switch nil (127.0 15.0 244.0
  2421.         41.0) lightGray 1 (text '') (varying) (color (isNil) (makeInsideColor:
  2422.         lightGray))) (Switch nil (127.0 93.0 244.0 119.0) black 1 (text '') (varying)
  2423.         (color (isNil) (makeInsideColor: black))) (Switch nil (127.0 67.0 244.0
  2424.         93.0) darkGray 1 (text '') (varying) (color (isNil) (makeInsideColor:
  2425.         darkGray))) (Switch nil (127.0 41.0 244.0 67.0) gray 1 (text '') (varying)
  2426.         (color (isNil) (makeInsideColor: gray))) (Switch nil (127.0 -63.0 244.0
  2427.         -37.0) white 1 (text 'transparent') (varying) (color (isNil) (makeInsideColor:
  2428.         nil))) (Switch nil (89 -57 104 -42) white 1 (form DefaultFormLibrary check)
  2429.         (lockedConstant fixCenter 0) (color (isInsideColor: nil) (makeInsideColor:
  2430.         nil))) (Switch nil (89 -31 104 -16) white 1 (form DefaultFormLibrary check)
  2431.         (lockedConstant fixCenter 0) (color (isInsideColor: white) (makeInsideColor:
  2432.         white))) (Switch nil (89 -5 104 10) white 1 (form DefaultFormLibrary check)
  2433.         (lockedConstant fixCenter 0) (color (isInsideColor: veryLightGray) (makeInsideColor:
  2434.         veryLightGray))) (Switch nil (89 21 104 36) white 1 (form DefaultFormLibrary
  2435.         check) (lockedConstant fixCenter 0) (color (isInsideColor: lightGray)
  2436.         (makeInsideColor: lightGray))) (Switch nil (89 47 104 62) white 1 (form
  2437.         DefaultFormLibrary check) (lockedConstant fixCenter 0) (color (isInsideColor:
  2438.         gray) (makeInsideColor: gray))) (Switch nil (89 73 104 88) white 1 (form
  2439.         DefaultFormLibrary check) (lockedConstant fixCenter 0) (color (isInsideColor:
  2440.         darkGray) (makeInsideColor: darkGray))) (Switch nil (89 99 104 114) white
  2441.         1 (form DefaultFormLibrary check) (lockedConstant fixCenter 0) (color
  2442.         (isInsideColor: black) (makeInsideColor: black))))))))).
  2443.     ^anArray!
  2444. makeMethodWindow
  2445.     "Returns an initialized view."
  2446.     | anArray |
  2447.  
  2448.     anArray _ "WindowMaker edit:" #(Master nil (-204 -165 205 165) white 2
  2449.         (1.56968 1.26297 319.215 248.61) true 'Output Options' (nil) (postCloseMakeMethod:
  2450.         anExtendedStandardSystemView) (350 180) (1000 1000) (classMethod notEncoded
  2451.         WindowMakerMasterIconController 'generic windows' makeMethodWindow 'generic windows overflow')
  2452.         ((Picture nil (-168.0 -10.0 -107.0 5.0) white 0 (text 'class name') (constant
  2453.         fixMiddleLeft) (nil (nil))) (Text nil (-29.0 -12.0 192.0 11.0) white 1
  2454.         (nil (outputOptionTextAt: methodClass) (outputOptionPutText: aText at:
  2455.         methodClass) (acceptCancelYellowButtonMenu))) (Picture nil (-168.0 36.0
  2456.         -74.0 51.0) white 0 (text 'method category') (constant fixMiddleLeft)
  2457.         (nil (nil))) (Text nil (-29.0 33.0 193.0 57.0) white 1 (nil (outputOptionTextAt:
  2458.         methodCategory) (outputOptionPutText: aText at: methodCategory) (acceptCancelYellowButtonMenu)))
  2459.         (Picture nil (-168.0 83.0 -92.0 98.0) white 0 (text 'method name') (constant
  2460.         fixMiddleLeft) (nil (nil))) (Text nil (-29.0 79.0 193.0 103.0) white 1
  2461.         (nil (outputOptionTextAt: methodName) (outputOptionPutText: aText at:
  2462.         methodName) (acceptCancelYellowButtonMenu))) (Picture nil (-192 -153 -104
  2463.         -138) white 0 (text 'where to output:') (lockedConstant fixMiddleLeft
  2464.         0) (nil (nil))) (Picture nil (-192 -92 -115 -77) white 0 (text 'how to output:')
  2465.         (lockedConstant fixMiddleLeft 0) (nil (nil))) (Picture nil (-192 -37 -102
  2466.         -22) white 0 (text 'method specifics:') (lockedConstant fixMiddleLeft
  2467.         0) (nil (nil))) (Picture nil (-168.0 132.0 -69.0 147.0) white 0 (text
  2468.         'overflow category') (lockedConstant fixMiddleLeft 0) (nil (nil))) (Text
  2469.         nil (-29.0 129.0 193.0 153.0) white 1 (nil (outputOptionTextAt: overflowCategory)
  2470.         (outputOptionPutText: aText at: overflowCategory) (acceptCancelYellowButtonMenu)))
  2471.         (Group nil (-201 -126 166 -103) nil 4 ((SwitchAndPicture nil (-168 -130
  2472.         -77 -115) white 0 (form DefaultFormLibrary button separation 10 text 
  2473.         'in transcript') (lockedConstant fixMiddleLeft 0) (outputOption (outputOptionAt:
  2474.         destination is: transcript) (outputOptionPutText: transcript at: destination)))
  2475.         (SwitchAndPicture nil (-57 -130 49 -115) white 0 (form DefaultFormLibrary
  2476.         button separation 10 text 'in class method') (lockedConstant fixMiddleLeft
  2477.         0) (outputOption (outputOptionAt: destination is: classMethod) (outputOptionPutText:
  2478.         classMethod at: destination))) (SwitchAndPicture nil (67 -130 191 -115)
  2479.         white 0 (form DefaultFormLibrary button separation 10 text 'in instance method')
  2480.         (lockedConstant fixMiddleLeft 0) (outputOption (outputOptionAt: destination
  2481.         is: instanceMethod) (outputOptionPutText: instanceMethod at: destination)))))
  2482.         (Group nil (-199 -62 68 -39) nil 4 ((SwitchAndPicture nil (-168 -66 -72
  2483.         -51) white 0 (form DefaultFormLibrary button separation 10 text 'encoding only')
  2484.         (lockedConstant fixMiddleLeft 0) (outputOption (outputOptionAt: encoding
  2485.         is: encoded) (outputOptionPutText: encoded at: encoding))) (SwitchAndPicture
  2486.         nil (-35 -66 91 -51) white 0 (form DefaultFormLibrary button separation
  2487.         10 text 'view with encoding') (lockedConstant fixMiddleLeft 0) (outputOption
  2488.         (outputOptionAt: encoding is: notEncoded) (outputOptionPutText: notEncoded
  2489.         at: encoding))))))).
  2490.     ^anArray!
  2491. switchAndPictureBackgroundWindow
  2492.     "Returns an initialized view."
  2493.     | anArray |
  2494.  
  2495.     anArray _ "WindowMaker edit:" #(Master nil (-210 -128 210 129) white 1
  2496.         (1.51809 1.7661 320.0 226.853) true 'Background' (preOpenBackground: anExtendedStandardSystemView)
  2497.         (postCloseBackground: anExtendedStandardSystemView) (500 300) (1000 1000)
  2498.         (classMethod notEncoded WindowMakerMasterIconController 'generic windows' switchAndPictureBackgroundWindow
  2499.         'generic windows overflow') ((Picture nil (-199.0 -117.0 -98.0 -102.0)
  2500.         white 0 (text 'switch and picture:') (lockedConstant fixMiddleLeft 0)
  2501.         (nil (nil))) (Picture nil (-179.0 -91.0 -145.0 -76.0) white 0 (text 'switch')
  2502.         (lockedConstant fixMiddleLeft 0) (nil (nil))) (Picture nil (-179.0 70.0
  2503.         -142.0 85.0) white 0 (text 'picture') (lockedConstant fixMiddleLeft 0)
  2504.         (nil (nil))) (External nil (-158.0 -66.0 199.0 52.0) nil 1 (FormLibrarian
  2505.         subView)) (Text nil (-158.0 98.0 -30.0 118.0) white 1 (nil (getPictureString)
  2506.         (changePictureString: aText) (acceptCancelYellowButtonMenu))))).
  2507.     ^anArray! !
  2508.  
  2509. Smalltalk garbageCollect!
  2510.  
  2511. !WindowMakerMasterIconController class methodsFor: 'generic windows overflow'! !
  2512.  
  2513. !WindowMakerMasterIconController class methodsFor: 'specific windows'!
  2514. externalWindow
  2515.     "Returns an initialized view."
  2516.     | anArray |
  2517.  
  2518.     anArray _ "WindowMaker edit:" #(Master nil (-137 -89 138 89) white 1 (3.73091
  2519.         2.43963 510.135 263.873) true 'External Window Interface' (preOpenInterface:
  2520.         anExtendedStandardSystemView) (nil) (350 180) (1000 1000) (classMethod notEncoded 
  2521.         WindowMakerMasterIconController 'specific windows' externalWindow 
  2522.         'specific windows overflow') ((Text messageSource (-136.0 -63.0 137.0 88.0) white 1 
  2523.         (messageSource (messageSource) (messageSource: aText) (messageMenu))) (Switch nil 
  2524.         (-136.0 -88.0 -45.0 -63.0) white 1 (text 'comment') (varying) (message (isMessage:
  2525.         comment) (message: comment))) (Switch nil (-45.0 -88.0 46.0 -63.0) white
  2526.         1 (text 'name') (varying) (message (isMessage: name) (message: name)))
  2527.         (Switch nil (46.0 -88.0 137.0 -63.0) white 1 (text 'getView') (varying)
  2528.         (message (isMessage: getView) (message: getView))))).
  2529.     ^anArray!
  2530. masterSizingWindow
  2531.     "Returns an initialized view."
  2532.     | anArray |
  2533.  
  2534.     anArray _ "WindowMaker edit:" #(Master nil (-221 -37 222 37) white 2 (1.44921
  2535.         5.63832 319.275 248.382) true 'Size Options' (nil) (nil) (440 72) (572 76) (classMethod 
  2536.         notEncoded WindowMakerMasterIconController 'specific windows' masterSizingWindow
  2537.         'specific windows overflow') ((Picture nil (-209 -23 -125 -8) white 0
  2538.         (text 'minimum size') (constant fixMiddleLeft) (nil (nil))) (Text nil
  2539.         (-83.0 -25.0 -22.0 -7.0) white 1 (sizing (getMinimumSize) (changeMinimumSize:
  2540.         aText) (acceptCancelYellowButtonMenu))) (SwitchAndPicture nil (19 -23
  2541.         205 -8) white 0 (form DefaultFormLibrary button separation 10 text 'interactively set minimum size')
  2542.         (lockedConstant fixMiddleLeft 0) (nil (isNil) (setSize: minimum))) (Picture
  2543.         nil (-209 9 -125 24) white 0 (text 'maximum size') (constant fixMiddleLeft)
  2544.         (nil (nil))) (Text nil (-83.0 7.0 -22.0 25.0) white 1 (sizing (getMaximumSize)
  2545.         (changeMaximumSize: aText) (acceptCancelYellowButtonMenu))) (SwitchAndPicture
  2546.         nil (19 9 210 24) white 0 (form DefaultFormLibrary button separation 10
  2547.         text 'interactively set maximum size') (lockedConstant fixMiddleLeft 0)
  2548.         (nil (isNil) (setSize: maximum))))).
  2549.     ^anArray!
  2550. masterWindow
  2551.     "Returns an initialized view."
  2552.     | anArray |
  2553.  
  2554.     anArray _ "WindowMaker edit:" #(Master nil (-274 -114 274 115) white 1
  2555.         (1.87226 1.8919 512.0 263.431) true 'Master Window Interface' (preOpenInterface:
  2556.         anExtendedStandardSystemView) (nil) (350 180) (1000 1000) (classMethod notEncoded 
  2557.         WindowMakerMasterIconController 'specific windows' topWindow 
  2558.         'specific windows overflow') ((Text messageSource (-273.0 -88.0 273.0 114.0) white 1 
  2559.         (messageSource (messageSource) (messageSource: aText) (messageMenu))) (Group nil 
  2560.         (-277 -117 277 -84) nil 4 ((Switch nil (-273.0 -113.0 -182.0 -88.0) white 1
  2561.         (text 'comment') (varying) (message (isMessage: comment) (message: comment)))
  2562.         (Switch nil (-182.0 -113.0 -91.0 -88.0) white 1 (text 'name') (varying)
  2563.         (message (isMessage: name) (message: name))) (Switch nil (-91.0 -113.0
  2564.         0.0 -88.0) white 1 (text 'topView') (varying) (message (isMessage: topView)
  2565.         (message: topView))) (Switch nil (0.0 -113.0 91.0 -88.0) white 1 (text
  2566.         'title') (varying) (message (isMessage: title) (message: title))) (Switch
  2567.         nil (91.0 -113.0 182.0 -88.0) white 1 (text 'preOpen') (varying) (message
  2568.         (isMessage: preOpeningSelector) (message: preOpeningSelector))) (Switch
  2569.         nil (182.0 -113.0 273.0 -88.0) white 1 (text 'postClose') (varying) (message
  2570.         (isMessage: postClosingSelector) (message: postClosingSelector))))))).
  2571.     ^anArray!
  2572. menuWindow
  2573.     "Returns an initialized view."
  2574.     | anArray |
  2575.  
  2576.     anArray _ "WindowMaker edit:" #(Master nil (-256 -89 257 89) white 1 (2.0
  2577.         2.43465 511.0 264.316) true 'Menu Window Interface' (preOpenInterface:
  2578.         anExtendedStandardSystemView) (nil) (350 180) (1000 1000) (classMethod notEncoded 
  2579.         WindowMakerMasterIconController 'specific windows' menuWindow 
  2580.         'specific windows overflow') ((Text messageSource (-255.0 -63.0 256.0 88.0) white 1
  2581.         (messageSource (messageSource) (messageSource: aText) (messageMenu))) (Group nil 
  2582.         (-370 -93 141 -68) nil 4 ((Switch nil (-255.0 -88.0 -182.0 -63.0) white 1 (text
  2583.         'comment') (varying) (message (isMessage: comment) (message: comment)))
  2584.         (Switch nil (-182.0 -88.0 -109.0 -63.0) white 1 (text 'name') (varying)
  2585.         (message (isMessage: name) (message: name))) (Switch nil (-109.0 -88.0
  2586.         -36.0 -63.0) white 1 (text 'updateSymbol') (varying) (message (isMessage:
  2587.         updateSymbol) (message: updateSymbol))) (Switch nil (-36.0 -88.0 37.0
  2588.         -63.0) white 1 (text 'getMenu') (varying) (message (isMessage: getMenuArray)
  2589.         (message: getMenuArray))) (Switch nil (37.0 -88.0 110.0 -63.0) white 1
  2590.         (text 'getSelection') (varying) (message (isMessage: getMenuSelection)
  2591.         (message: getMenuSelection))) (Switch nil (110.0 -88.0 183.0 -63.0) white
  2592.         1 (text 'changeSelection') (varying) (message (isMessage: changeMenuSelection)
  2593.         (message: changeMenuSelection))) (Switch nil (183.0 -88.0 256.0 -63.0)
  2594.         white 1 (text 'getYellowMenu') (varying) (message (isMessage: getYellowMenu)
  2595.         (message: getYellowMenu))))))).
  2596.     ^anArray!
  2597. pictureWindow
  2598.     "Returns an initialized view."
  2599.     | anArray |
  2600.  
  2601.     anArray _ "WindowMaker edit:" #(Master nil (-183 -85 183 86) white 1 (2.80328
  2602.         2.53821 512.0 262.714) true 'Picture Window Interface' (preOpenInterface:
  2603.         anExtendedStandardSystemView) (nil) (350 180) (1000 1000) (classMethod notEncoded
  2604.         WindowMakerMasterIconController 'specific windows' pictureWindow 
  2605.         'specific windows overflow') ((Text messageSource (-182.0 -59.0 182.0 85.0) white 1
  2606.         (messageSource (messageSource) (messageSource: aText) (messageMenu))) (Group nil 
  2607.         (-272 -89 92 -64) nil 4 ((Switch nil (-91.0 -84.0 0.0 -59.0) white 1 (text 
  2608.         'name') (varying) (message (isMessage: name) (message: name))) (Switch
  2609.         nil (-182.0 -84.0 -91.0 -59.0) white 1 (text 'comment') (varying) (message
  2610.         (isMessage: comment) (message: comment))) (Switch nil (0.0 -84.0 91.0
  2611.         -59.0) white 1 (text 'updateSymbol') (varying) (message (isMessage: updateSymbol)
  2612.         (message: updateSymbol))) (Switch nil (91.0 -84.0 182.0 -59.0) white 1
  2613.         (text 'getLabel') (varying) (message (isMessage: getLabel) (message: getLabel))))))).
  2614.     ^anArray!
  2615. switchandpictureWindow
  2616.     ^self switchWindow!
  2617. switchWindow
  2618.     "Returns an initialized view."
  2619.     | anArray |
  2620.  
  2621.     anArray _ "WindowMaker edit:" #(Master nil (-228 -100 229 101) white 1
  2622.         (2.24508 2.16009 510.877 262.831) true 'Switch Window Interface' (preOpenInterface:
  2623.         anExtendedStandardSystemView) (nil) (350 180) (1000 1000) (classMethod notEncoded
  2624.         WindowMakerMasterIconController 'specific windows' switchWindow 
  2625.         'specific windows overflow') ((Text messageSource (-227.0 -74.0 228.0 100.0) white 1
  2626.         (messageSource (messageSource) (messageSource: aText) (messageMenu))) (Group nil 
  2627.         (-283 -91 172 -66) nil 4 ((Switch nil (-227.0 -99.0 -136.0 -74.0) white 1 (text
  2628.         'comment') (varying) (message (isMessage: comment) (message: comment)))
  2629.         (Switch nil (-136.0 -99.0 -45.0 -74.0) white 1 (text 'name') (varying)
  2630.         (message (isMessage: name) (message: name))) (Switch nil (-45.0 -99.0
  2631.         46.0 -74.0) white 1 (text 'updateSymbol') (varying) (message (isMessage:
  2632.         updateSymbol) (message: updateSymbol))) (Switch nil (46.0 -99.0 137.0
  2633.         -74.0) white 1 (text 'isOn') (varying) (message (isMessage: isOn) (message:
  2634.         isOn))) (Switch nil (137.0 -99.0 228.0 -74.0) white 1 (text 'switch')
  2635.         (varying) (message (isMessage: switch) (message: switch))))))).
  2636.     ^anArray!
  2637. textWindow
  2638.     "Returns an initialized view."
  2639.     | anArray |
  2640.  
  2641.     anArray _ "WindowMaker edit:" #(Master nil (-274 -114 274 115) white 1
  2642.         (1.87226 1.89432 512.0 263.153) true 'Text Window Interface' (preOpenInterface:
  2643.         anExtendedStandardSystemView) (nil) (350 180) (1000 1000) (classMethod notEncoded
  2644.         WindowMakerMasterIconController 'specific windows' textWindow 
  2645.         'specific windows overflow') ((Text messageSource (-273.0 -88.0 273.0 114.0) white 
  2646.         1 (messageSource (messageSource) (messageSource: aText) (messageMenu))) (Group nil 
  2647.         (-344 -134 202 -109) nil 4 ((Switch nil (-273.0 -113.0 -182.0 -88.0) white 1
  2648.         (text 'comment') (varying) (message (isMessage: comment) (message: comment)))
  2649.         (Switch nil (-182.0 -113.0 -91.0 -88.0) white 1 (text 'name') (varying)
  2650.         (message (isMessage: name) (message: name))) (Switch nil (-91.0 -113.0
  2651.         0.0 -88.0) white 1 (text 'updateSymbol') (varying) (message (isMessage:
  2652.         updateSymbol) (message: updateSymbol))) (Switch nil (0.0 -113.0 91.0 -88.0)
  2653.         white 1 (text 'getText') (varying) (message (isMessage: getText) (message:
  2654.         getText))) (Switch nil (91.0 -113.0 182.0 -88.0) white 1 (text 'changeText')
  2655.         (varying) (message (isMessage: changeText) (message: changeText))) (Switch
  2656.         nil (182.0 -113.0 273.0 -88.0) white 1 (text 'getMenu') (varying) (message
  2657.         (isMessage: getMenu) (message: getMenu))))))).
  2658.     ^anArray! !
  2659.  
  2660. !WindowMakerMasterIconController class methodsFor: 'specific windows overflow'! !
  2661.  
  2662.  
  2663. WindowMakerIcon subclass: #WindowMakerMenuIcon
  2664.     instanceVariableNames: ''
  2665.     classVariableNames: ''
  2666.     poolDictionaries: ''
  2667.     category: 'WindowMaker'!
  2668.  
  2669. !WindowMakerMenuIcon methodsFor: 'instance initialization'!
  2670. initialize
  2671.     super initialize.
  2672.     defaultLabelSelector _ #getMenuArray!
  2673. initializeMessages
  2674.     super initializeMessages.
  2675.     self
  2676.         addMessage: #comment default: #defaultComment 
  2677.             parser: #parseComment: coding: nil;
  2678.         addMessage: #updateSymbol default: #defaultUpdateSymbol
  2679.             parser: #parseNilOrSymbol: coding: #(nil);
  2680.         addMessage: #getMenuArray default: #defaultGetMenuArray
  2681.             parser: #parseZeroOrMoreParametersMessage: coding: #(model getMenuArray);
  2682.         addMessage: #getMenuSelection default: #defaultGetMenuSelection
  2683.             parser: #parseZeroOrMoreParametersMessage: coding: #(model getMenuSelection);
  2684.         addMessage: #changeMenuSelection default: #defaultChangeMenuSelection
  2685.             parser: #parseOneOrMoreParametersMessage: coding: #(model changeMenuSelection: entryObject);
  2686.         addMessage: #getYellowMenu default: #defaultGetYellowMenu
  2687.             parser: #parseNilOrZeroOrMoreParameterMessage: coding: #(model getYellowMenu)! !
  2688.  
  2689. !WindowMakerMenuIcon methodsFor: 'encoding/decoding'!
  2690. decodeFrom: aStream
  2691.     "iconClass iconName window insideColor borderWidth (updateSymbol getMenuArrayMessage getMenuSelectionMessage changeMenuSelectionMessage getYellowMenuMessage)"
  2692.  
  2693.     | newStream |
  2694.     super decodeFrom: aStream.
  2695.     newStream _ ReadStream on: aStream next.
  2696.     self
  2697.         changeMessage: #updateSymbol receiver: newStream next;
  2698.         changeMessage: #getMenuArray selectorArguments: newStream next;
  2699.         changeMessage: #getMenuSelection selectorArguments: newStream next;
  2700.         changeMessage: #changeMenuSelection selectorArguments: newStream next;
  2701.         changeMessage: #getYellowMenu selectorArguments: newStream next!
  2702. encodeOn: aStream
  2703.     "iconClass iconName window insideColor borderWidth (updateSymbol getMenuArrayMessage getMenuSelectionMessage changeMenuSelectionMessage getYellowMenuMessage)"
  2704.  
  2705.     super encodeOn: aStream.
  2706.     aStream
  2707.         space; nextPut: $(; store: (self receiverFor: #updateSymbol);
  2708.         space; store: (self codingWithoutReceiverFor: #getMenuArray);
  2709.         space; store: (self codingWithoutReceiverFor: #getMenuSelection);
  2710.         space; store: (self codingWithoutReceiverFor: #changeMenuSelection);
  2711.         space; store: (self codingWithoutReceiverFor: #getYellowMenu);
  2712.         nextPut: $)! !
  2713.  
  2714. !WindowMakerMenuIcon methodsFor: 'generating views'!
  2715. asView
  2716.     | aView |
  2717.     aView _ ExtendedMenuView on: nil
  2718.         printItems: true oneItem: false
  2719.         aspect: (self receiverFor: #updateSymbol) 
  2720.         change: (self selectorArgumentsFor: #changeMenuSelection)
  2721.         list: (self selectorArgumentsFor: #getMenuArray)
  2722.         menu: (self selectorArgumentsFor: #getYellowMenu)
  2723.         initialSelection: (self selectorArgumentsFor: #getMenuSelection).
  2724.     aView
  2725.         name: (self receiverFor: #name);
  2726.         insideColor: insideColor;
  2727.         borderWidthLeft: borderWidth left right: borderWidth right 
  2728.             top: borderWidth top bottom: borderWidth bottom;
  2729.         window: window;
  2730.         transformation: transformation.
  2731.     ^aView! !
  2732.  
  2733. !WindowMakerMenuIcon methodsFor: 'interface window defaults'!
  2734. defaultChangeMenuSelection
  2735.     ^Text
  2736.         string: '
  2737.     model changeMenuSelection: #aSelection
  2738.  
  2739. "other examples:
  2740.     model changeMenuSelection: #aSelection forPane: 1
  2741.     model changeMenuSelection: #aSelection for: ''method'' suffix: '' category''
  2742.  
  2743. comment: The change-menu-selection message is used by the menu window to inform the model that a new selection has been made. This selection is provided in the first parameter; either a getMenu array entry if a selection has been made or nil if a deselection has occurred.
  2744.  
  2745. when used: This message is sent to the model whenever the user interactively modifies the window. 
  2746.  
  2747. restrictions: The receiver must be ''model''. One or more constant parameters can be specified; nil, true, and false are permitted. The first parameter (#aSelection above) is replaced by the actual selection object (if an actual selection was made) or nil (if a deselection was made) before the message is sent. The result returned is ignored."'
  2748.         runs: (RunArray
  2749.             runs: #(8 19 16 14 9 19 13 8 11 19 13 4 11 6 15 7 5 22 240 9 91 12 82 3 2 4 6 5 75 23 38 3 89 )
  2750.             values: #(1 2 1 2 1 2 1 2 1 2 1 2 1 2 1 2 1 2 1 2 1 2 1 2 1 2 1 2 1 2 1 2 1 ))!
  2751. defaultComment
  2752.     ^Text
  2753.         string: '
  2754. A menu window communicates with its model via messages
  2755.  
  2756.     (1)    getMenu to obtain the permanent menu from the model 
  2757.             (an array of objects with distinct print strings).
  2758.     (2)    getSelection to obtain the menu selection to be displayed from the model 
  2759.             (one of the objects in the above array or nil).
  2760.     (3)    changeSelection to tell the model of a menu selection change 
  2761.             (one of the objects in the above array or nil).
  2762.     (4)    getYellowMenu to obtain the yellow button pop-up menu from the model
  2763.             (an action menu).
  2764.  
  2765. updateSymbol comments: If the model changes its version of the permanent menu or the menu selection and the window should reflect the model''s version, the model should send a ''self changed: #updateSymbol'' message. This could be done anywhere including in the above four methods.'
  2766.         runs: (RunArray
  2767.             runs: #(3 11 48 8 104 13 117 16 102 14 78 21 257 )
  2768.             values: #(1 2 1 2 1 2 1 2 1 2 1 2 1 ))!
  2769. defaultGetMenuArray
  2770.     ^Text
  2771.         string: '
  2772.     model getMenuArray
  2773.  
  2774. "other examples:
  2775.     model getMenuArrayFor: #names
  2776.     model getMenuArrayFor: ''method'' suffix: '' category''
  2777.  
  2778. comment: The get-menu-array message is used by the menu window to ask the model for the permanent menu entries to be displayed. 
  2779.  
  2780. when used: This message is sent to the model (1) when the window is initially displayed and (2) each time it reacts to a ''self changed: #updateSymbol'' message sent by the model. 
  2781.  
  2782. restrictions: The receiver must be ''model''. Any number of constant parameters can be specified; nil, true, and false are permitted. The result returned must be an array of arbitrary objects with distinct print strings; an ordered collection instead of an array, for example, is not permitted."'
  2783.         runs: (RunArray
  2784.             runs: #(8 12 3 14 9 15 16 15 11 6 15 7 5 15 103 9 171 12 84 3 2 4 6 5 177 )
  2785.             values: #(1 2 1 2 1 2 1 2 1 2 1 2 1 2 1 2 1 2 1 2 1 2 1 2 1 ))!
  2786. defaultGetMenuSelection
  2787.     ^Text
  2788.         string: '
  2789.     model getMenuSelection
  2790.  
  2791. "other examples:
  2792.     model getMenuSelectionFor: #names
  2793.     model getMenuSelectionFor: ''method'' suffix: '' category''
  2794.  
  2795. comment: The get-selection message is used by the menu window to ask the model for the current selection. If a selection has been made, the corresponding getMenu array element is returned; otherwise, nil.
  2796.  
  2797. when used: This message is sent to the model (1) when the window is initially displayed and (2) each time it reacts to a ''self changed: #updateSymbol'' message sent by the model.
  2798.  
  2799. restrictions: The receiver must be ''model''. Any number of constant parameters can be specified; nil, true, and false are permitted. The result returned must be one of the objects in the permanent menu array (the one selected) or nil (for no selection)."'
  2800.         runs: (RunArray
  2801.             runs: #(8 16 3 14 9 19 16 19 11 6 15 7 5 14 180 9 170 12 84 3 2 4 6 5 137 )
  2802.             values: #(1 2 1 2 1 2 1 2 1 2 1 2 1 2 1 2 1 2 1 2 1 2 1 2 1 ))! !
  2803.  
  2804.  
  2805. WindowMakerIcon subclass: #WindowMakerSwitchOrPictureIcon
  2806.     instanceVariableNames: 'pictureVariety pictureString pictureFormPathName lockedSizeExpansion '
  2807.     classVariableNames: ''
  2808.     poolDictionaries: ''
  2809.     category: 'WindowMaker'!
  2810.  
  2811. !WindowMakerSwitchOrPictureIcon methodsFor: 'instance initialization'!
  2812. initialize
  2813.     super initialize.
  2814.     pictureVariety _ #text.
  2815.     pictureString _ 'picture'.
  2816.     pictureFormPathName _ #(DefaultFormLibrary button).
  2817.     lockedSizeExpansion _ 0! !
  2818.  
  2819. !WindowMakerSwitchOrPictureIcon methodsFor: 'access/modification'!
  2820. lockedSizeExpansion
  2821.     ^lockedSizeExpansion!
  2822. lockedSizeExpansion: anInteger
  2823.     lockedSizeExpansion _ anInteger!
  2824. pictureFormPathName
  2825.     ^pictureFormPathName!
  2826. pictureFormPathName: anArray
  2827.     pictureFormPathName _ anArray!
  2828. pictureString
  2829.     ^pictureString!
  2830. pictureString: aString
  2831.     pictureString _ aString!
  2832. pictureVariety
  2833.     ^pictureVariety!
  2834. pictureVariety: aSymbol
  2835.     pictureVariety _ aSymbol! !
  2836.  
  2837. !WindowMakerSwitchOrPictureIcon methodsFor: 'encoding/decoding'!
  2838. decodeFrom: aStream
  2839.     "iconClass iconName window insideColor borderWidth pictureData modeData"
  2840.  
  2841.     super decodeFrom: aStream.
  2842.     self decodePictureData: aStream next.
  2843.     self decodeModeData: aStream next.
  2844.     self computeLabel!
  2845. decodeModeData: data
  2846.     "The mode data is of the form
  2847.         #varying 
  2848.         #constant fixedPoint or
  2849.         #lockedConstant fixedPoint lockedSizeExpansion where
  2850.             fixedPoint is one of
  2851.                 #fixCenter, #fixTopLeft, #fixBottomRight, ...
  2852.             lockedSizeExpansion is an integer"
  2853.  
  2854.     | newMode |
  2855.     self fixMiddleLeft; lockedSizeExpansion: 0. sizeLocked _ false.
  2856.     (newMode _ data at: 1) == #varying ifFalse: [
  2857.         self perform: (data at: 2). "#fixCenter, #fixTopLeft, #fixBottomRight, ..."
  2858.         newMode == #lockedConstant ifTrue: [
  2859.             sizeLocked _ true. newMode _ #constant. self lockedSizeExpansion: (data at: 3)]].
  2860.     self mode: newMode!
  2861. decodePictureData: data
  2862.     "The picture data is either of the form
  2863.             #text 'string' or 
  2864.             #form libraryName switchName"
  2865.  
  2866.     pictureVariety _ data at: 1.
  2867.     pictureVariety == #text
  2868.         ifTrue: [
  2869.             pictureString _ data at: 2.
  2870.             pictureFormPathName _ #(DefaultFormLibrary button)]
  2871.         ifFalse: [
  2872.             pictureString _ ''.
  2873.             pictureFormPathName _ data copyFrom: 2 to: 3]!
  2874. encodedModeData
  2875.     "The mode data is of the form
  2876.         #varying 
  2877.         #constant fixedPoint or
  2878.         #lockedConstant fixedPoint lockedSizeExpansion where
  2879.             fixedPoint is one of
  2880.                 #fixCenter, #fixTopLeft, #fixBottomRight, ...
  2881.             lockedSizeExpansion is an integer"
  2882.  
  2883.     mode == #varying ifTrue: [^Array with: #varying].
  2884.     sizeLocked ifFalse: [^Array with: #constant with: self fixedPointEncoding].
  2885.     ^Array with: #lockedConstant with: self fixedPointEncoding with: lockedSizeExpansion!
  2886. encodedPictureData
  2887.     "The picture data is either of the form
  2888.             #text 'string' or 
  2889.             #form libraryName switchName"
  2890.  
  2891.     pictureVariety == #text
  2892.         ifTrue: [^Array with: #text with: pictureString]
  2893.         ifFalse: [^(Array with: #form), pictureFormPathName]!
  2894. encodeOn: aStream
  2895.     "iconClass iconName window insideColor borderWidth pictureData modeData"
  2896.  
  2897.     super encodeOn: aStream.
  2898.     aStream 
  2899.         space; store: self encodedPictureData; 
  2900.         space; store: self encodedModeData! !
  2901.  
  2902. !WindowMakerSwitchOrPictureIcon methodsFor: 'background'!
  2903. computeLabel
  2904.     "Construct a new label from the current settings; i.e., from the switch path name or picture string. The icon display box may change if the label changes size."
  2905.  
  2906.     | newLabel |
  2907.     newLabel _ self getLabel.
  2908.  
  2909.     sizeLocked ifTrue: [
  2910.         sizeLocked _ false.
  2911.         "Avoid the following method since it computes the display box (works only if this icon has a superview); e.g., after initialization."
  2912.         "self growTo: (newLabel extent max: 10@10)."
  2913.         window extent: (newLabel extent + (lockedSizeExpansion*2) max: 10@10). 
  2914.         self unlock; lock.
  2915.         sizeLocked _ true].
  2916.  
  2917.     self label: newLabel!
  2918. generateLabel
  2919.     "Construct a new label from the current settings; one that can be used to specify a label for a new view."
  2920.  
  2921.     ^pictureVariety == #text
  2922.         ifTrue: [pictureString asParagraph]
  2923.         ifFalse: [pictureFormPathName]!
  2924. getLabel
  2925.     "Construct a new label from the current settings; one that permits the extent to be computed."
  2926.  
  2927.     ^pictureVariety == #text
  2928.         ifTrue: [pictureString asParagraph]
  2929.         ifFalse: [FormLibrarian formForPathName: pictureFormPathName]! !
  2930.  
  2931.  
  2932. WindowMakerSwitchOrPictureIcon subclass: #WindowMakerPictureIcon
  2933.     instanceVariableNames: ''
  2934.     classVariableNames: ''
  2935.     poolDictionaries: ''
  2936.     category: 'WindowMaker'!
  2937.  
  2938. !WindowMakerPictureIcon methodsFor: 'instance initialization'!
  2939. initialize
  2940.     super initialize.
  2941.     self sizeLocked: true; mode: #constant; fixMiddleLeft; lockedSizeExpansion: 0.
  2942.     self borderWidth: 0. "override"!
  2943. initializeMessages
  2944.     super initializeMessages.
  2945.     self
  2946.         addMessage: #comment default: #defaultComment
  2947.             parser: #parseComment: coding: nil;
  2948.         addMessage: #updateSymbol default: #defaultUpdateSymbol
  2949.             parser: #parseNilOrSymbol: coding: #(nil);
  2950.         addMessage: #getLabel default: #defaultGetLabel
  2951.             parser: #parseNilOrZeroOrMoreParameterMessage: coding: #(nil).! !
  2952.  
  2953. !WindowMakerPictureIcon methodsFor: 'encoding/decoding'!
  2954. decodeFrom: aStream
  2955.     "iconClass iconName window insideColor borderWidth pictureData modeData (updateSymbol getLabelMessage)"
  2956.  
  2957.     | newStream |
  2958.     super decodeFrom: aStream.
  2959.     newStream _ ReadStream on: aStream next.
  2960.     self
  2961.         changeMessage: #updateSymbol receiver: newStream next;
  2962.         changeMessage: #getLabel selectorArguments: newStream next!
  2963. encodeOn: aStream
  2964.     "iconClass iconName window insideColor borderWidth pictureData modeData (updateSymbol getLabelMessage)"
  2965.  
  2966.     super encodeOn: aStream.
  2967.     aStream
  2968.         space; nextPut: $(; store: (self receiverFor: #updateSymbol);
  2969.         space; store: (self codingWithoutReceiverFor: #getLabel);
  2970.         nextPut: $)! !
  2971.  
  2972. !WindowMakerPictureIcon methodsFor: 'generating views'!
  2973. asView
  2974.     ^(ExtendedPictureView on: nil
  2975.         aspect: (self receiverFor: #updateSymbol)
  2976.         label: self generateLabel
  2977.         getLabel: (self selectorArgumentsFor: #getLabel))
  2978.         name: (self receiverFor: #name);
  2979.         insideColor: insideColor;
  2980.         borderWidthLeft: borderWidth left right: borderWidth right 
  2981.             top: borderWidth top bottom: borderWidth bottom;
  2982.         window: window;
  2983.         transformation: transformation;
  2984.         mode: self mode;
  2985.         perform: self fixedPointEncoding;
  2986.         yourself! !
  2987.  
  2988. !WindowMakerPictureIcon methodsFor: 'interface window defaults'!
  2989. defaultComment
  2990.     ^Text
  2991.         string: '
  2992. Normally, a picture window contains a label (picture) that remains unchanged throughout its existence. However, there may be situations where this label may have to vary dynamically. For an example, see the form librarian editor. In that case, 2 additional pieces of information must be provided:
  2993.  
  2994.     (1) #updateSymbol that identifies the window for changes,
  2995.     (2)    getLabel message to obtain a new display object; e.g., a form or a paragraph.
  2996.  
  2997. If the model changes in such a way that this picture window must be updated, it is sufficient for the model to execute "self changed: #updateSymbol".'
  2998.         runs: (RunArray
  2999.             runs: #(13 14 12 5 2 7 538 )
  3000.             values: #(1 2 1 2 1 2 1 ))!
  3001. defaultGetLabel
  3002.     ^Text
  3003.         string: '
  3004.     nil
  3005.  
  3006. "other examples:
  3007.     model getLabel
  3008.     model getLabelFor: #firstName
  3009.  
  3010. comment: The get-label message (when not nil) is used by the window to ask the model for a new label (picture) to be displayed. This label must be nil or a display object such as a display text, a paragraph, or a form.
  3011.  
  3012. when used: This message is sent to the model (1) each time the window is displayed and (2) each time it reacts to a ''self changed: #updateSymbol'' message sent by the model. 
  3013.  
  3014. aside: A non-nil get-label message is useful only if the window picture must change dynamically.
  3015.  
  3016. restrictions: The receiver for a non-nil get-label message must be ''model''. Any number of constant parameters can be specified; nil, true, and false are permitted. The result returned must be nil or a display object; e.g., a paragraph, display text, or form."'
  3017.         runs: (RunArray
  3018.             runs: #(8 14 9 8 8 12 13 7 5 10 198 9 166 5 93 12 116 3 2 4 6 5 111 )
  3019.             values: #(1 2 1 2 1 2 1 2 1 2 1 2 1 2 1 2 1 2 1 2 1 2 1 ))! !
  3020.  
  3021.  
  3022. WindowMakerSwitchOrPictureIcon subclass: #WindowMakerSwitchIcon
  3023.     instanceVariableNames: ''
  3024.     classVariableNames: ''
  3025.     poolDictionaries: ''
  3026.     category: 'WindowMaker'!
  3027.  
  3028. !WindowMakerSwitchIcon methodsFor: 'instance initialization'!
  3029. initialize
  3030.     super initialize.
  3031.     pictureString _ 'switch'. "override default"!
  3032. initializeMessages
  3033.     super initializeMessages.
  3034.     self
  3035.         addMessage: #comment default: #defaultComment
  3036.             parser: #parseComment: coding: nil;
  3037.         addMessage: #updateSymbol default: #defaultUpdateSymbol
  3038.             parser: #parseNilOrSymbol: coding: #(nil);
  3039.         addMessage: #isOn default: #defaultIsOn
  3040.             parser: #parseZeroOrMoreParametersMessage: coding: #(model isOn);
  3041.         addMessage: #switch default: #defaultSwitch
  3042.             parser: #parseZeroOrMoreParametersMessage: coding: #(model switch)! !
  3043.  
  3044. !WindowMakerSwitchIcon methodsFor: 'encoding/decoding'!
  3045. decodeFrom: aStream
  3046.     "iconClass iconName window insideColor borderWidth pictureData modeData (updateSymbol isOnMessage switchMessage)"
  3047.  
  3048.     | newStream |
  3049.     super decodeFrom: aStream.
  3050.     newStream _ ReadStream on: aStream next.
  3051.     self
  3052.         changeMessage: #updateSymbol receiver: newStream next;
  3053.         changeMessage: #isOn selectorArguments: newStream next;
  3054.         changeMessage: #switch selectorArguments: newStream next!
  3055. encodeOn: aStream
  3056.     "iconClass iconName window insideColor borderWidth pictureData modeData (updateSymbol isOnMessage switchMessage)"
  3057.  
  3058.     super encodeOn: aStream.
  3059.     aStream
  3060.         space; nextPut: $(; store: (self receiverFor: #updateSymbol);
  3061.         space; store: (self codingWithoutReceiverFor: #isOn);
  3062.         space; store: (self codingWithoutReceiverFor: #switch);
  3063.         nextPut: $)! !
  3064.  
  3065. !WindowMakerSwitchIcon methodsFor: 'generating views'!
  3066. asView
  3067.     ^(self viewClass on: nil
  3068.         aspect: (self receiverFor: #updateSymbol)
  3069.         label: self generateLabel
  3070.         isOn: (self selectorArgumentsFor: #isOn)
  3071.         switch: (self selectorArgumentsFor: #switch))
  3072.         name: (self receiverFor: #name);
  3073.         insideColor: insideColor;
  3074.         borderWidthLeft: borderWidth left right: borderWidth right 
  3075.             top: borderWidth top bottom: borderWidth bottom;
  3076.         window: self window;
  3077.         transformation: self transformation;
  3078.         highlight: self generateHighlight;
  3079.         mode: self mode;
  3080.         perform: self fixedPointEncoding;
  3081.         yourself!
  3082. viewClass
  3083.     ^ExtendedSwitchView! !
  3084.  
  3085. !WindowMakerSwitchIcon methodsFor: 'interface window defaults'!
  3086. defaultComment
  3087.     ^Text
  3088.         string: '
  3089. A switch window communicates with its model via 2 messages
  3090.  
  3091.     (1)    isOn to ask the model if the switch is on (the switch status).
  3092.     (2)    switch to tell the model that the switch has been pressed.
  3093.  
  3094. updateSymbol comments: If the model changes the switch status and the window should reflect the model''s version, the model should send a ''self changed: #updateSymbol'' message. This could be done anywhere including in the above two methods.'
  3095.         runs: (RunArray
  3096.             runs: #(3 13 50 4 43 13 8 6 54 21 218 )
  3097.             values: #(1 2 1 2 1 2 1 2 1 2 1 ))!
  3098. defaultIsOn
  3099.     ^Text
  3100.         string: '
  3101.     model isOn
  3102.  
  3103. "other examples:
  3104.     model isColor: #blue
  3105.     model isBorderSize: 1
  3106.  
  3107. comment: The is-on message is used by the switch window to ask the model if the switch is on. 
  3108.  
  3109. when used: This message is sent to the model (1) when the switch window is initially displayed and (2) each time it reacts to a ''self changed: #updateSymbol'' message sent by the model. 
  3110.  
  3111. restrictions: The receiver must be ''model''. Any number of constant parameters can be specified; nil, true, and false are permitted. The result returned must be a boolean: true to indicate the switch is down (depressed), false to indicate the switch is up (not depressed)."'
  3112.         runs: (RunArray
  3113.             runs: #(8 4 3 14 9 7 15 12 5 7 5 6 78 9 178 12 84 3 2 4 6 5 55 4 45 5 47 )
  3114.             values: #(1 2 1 2 1 2 1 2 1 2 1 2 1 2 1 2 1 2 1 2 1 2 1 2 1 2 1 ))!
  3115. defaultSwitch
  3116.     ^Text
  3117.         string: '
  3118.     model switch
  3119.  
  3120. "other examples:
  3121.     model turnOn
  3122.     model turnOff
  3123.     model makeColor: #blue
  3124.     model makeBorderSize: 1
  3125.  
  3126. comment: The switch message is used by the switch window to tell the model that the switch has been pressed. The model will appropriately change its state; e.g., by setting one of its instance variables. The switch window subsequently asks the model (using the isOn message) to find out whether this caused the switch to turn on (the isOn message replies true) or off (the isOn message replies false).
  3127.  
  3128. when used: when the user interactively pushes the mouse button while in the switch window.
  3129.  
  3130. restrictions: The receiver must be ''model''. Any number of constant parameters can be specified; nil, true, and false are permitted. The result returned is ignored.
  3131.  
  3132. sample methods: If the methods for the above messages are implemented as follows, then the switch, turnOn, and turnOff methods will work as expected.
  3133.  
  3134.     turnOn
  3135.         internalState _ true
  3136.     turnOff
  3137.         internalState _ false
  3138.     switch
  3139.         internalState _ internalState not
  3140.     isOn
  3141.         ^internalState"'
  3142.         runs: (RunArray
  3143.             runs: #(8 6 3 14 9 6 8 7 8 9 15 14 5 7 5 7 242 4 69 4 17 4 14 4 17 5 4 9 83 12 84 3 2 4 6 5 49 14 138 6 25 7 26 6 38 4 18 )
  3144.             values: #(1 2 1 2 1 2 1 2 1 2 1 2 1 2 1 2 1 2 1 2 1 2 1 2 1 2 1 2 1 2 1 2 1 2 1 2 1 2 1 2 1 2 1 2 1 2 1 ))! !
  3145.  
  3146. !WindowMakerSwitchIcon methodsFor: 'background'!
  3147. generateHighlight
  3148.     | offForm |
  3149.     pictureVariety == #form
  3150.         ifTrue: [
  3151.             offForm _ FormLibrarian formForPathName: pictureFormPathName.
  3152.             (offForm respondsTo: #highlight)
  3153.                 ifTrue: [^#fromLabel]
  3154.                 ifFalse: [^nil]]
  3155.         ifFalse: [^nil]! !
  3156.  
  3157.  
  3158. WindowMakerSwitchIcon subclass: #WindowMakerSwitchAndPictureIcon
  3159.     instanceVariableNames: 'separation '
  3160.     classVariableNames: ''
  3161.     poolDictionaries: ''
  3162.     category: 'WindowMaker'!
  3163.  
  3164. !WindowMakerSwitchAndPictureIcon methodsFor: 'instance initialization'!
  3165. initialize
  3166.     super initialize.
  3167.     self borderWidth: 0. "override"
  3168.     separation _ 10.
  3169.     self sizeLocked: true; mode: #constant; fixMiddleLeft; lockedSizeExpansion: 0.
  3170.     pictureVariety _ #form! !
  3171.  
  3172. !WindowMakerSwitchAndPictureIcon methodsFor: 'encoding/decoding'!
  3173. decodeModeData: data
  3174.     "The mode data is of the form
  3175.         #lockedConstant fixedPoint lockedSizeExpansion where
  3176.             fixedPoint is one of
  3177.                 #fixCenter, #fixTopLeft, #fixBottomRight, ...
  3178.             lockedSizeExpansion is an integer"
  3179.  
  3180.     self 
  3181.         mode: #constant;
  3182.         perform: (data at: 2); "#fixCenter, #fixTopLeft, #fixBottomRight, ..."
  3183.         lockedSizeExpansion: (data at: 3)!
  3184. decodePictureData: data
  3185.     "The picture data is of the form
  3186.             #form libraryName switchName #separation separation #text 'string'"
  3187.  
  3188.     pictureFormPathName _ data copyFrom: 2 to: 3.
  3189.     separation _ data at: 5.
  3190.     pictureString _ data at: 7!
  3191. encodedModeData
  3192.     "The mode data is of the form
  3193.         #lockedConstant fixedPoint lockedSizeExpansion where
  3194.             fixedPoint is one of
  3195.                 #fixCenter, #fixTopLeft, #fixBottomRight, ...
  3196.             lockedSizeExpansion is an integer"
  3197.  
  3198.     ^Array with: #lockedConstant with: self fixedPointEncoding with: lockedSizeExpansion!
  3199. encodedPictureData
  3200.     "The picture data is of the form
  3201.             #form libraryName switchName #separation separation #text 'string' "
  3202.  
  3203.     ^OrderedCollection new
  3204.         add: #form;
  3205.         addAll: pictureFormPathName;
  3206.         add: #separation;
  3207.         add: separation;
  3208.         add: #text;
  3209.         add: pictureString;
  3210.         asArray! !
  3211.  
  3212. !WindowMakerSwitchAndPictureIcon methodsFor: 'generating views'!
  3213. viewClass
  3214.     ^ExtendedSwitchAndPictureView! !
  3215.  
  3216. !WindowMakerSwitchAndPictureIcon methodsFor: 'background'!
  3217. generateLabel
  3218.     "Label must be of the form #(pictureFormPathName separation pictureString)."
  3219.     ^Array with: pictureFormPathName with: separation with: pictureString!
  3220. getLabel
  3221.     "Constructs a form from the switch path name, separation, and the picture string."
  3222.  
  3223.     | switchForm pictureForm width height combinedForm |
  3224.     switchForm _ FormLibrarian formForPathName: pictureFormPathName.
  3225.     switchForm isNil ifTrue: [switchForm _ Form extent: 0@0].
  3226.     pictureForm _ pictureString asParagraph asForm.
  3227.  
  3228.     width _ switchForm width + separation + pictureForm width.
  3229.     height _ switchForm height max: pictureForm height.
  3230.     combinedForm _ Form extent: width@height.
  3231.  
  3232.     switchForm displayOn: combinedForm 
  3233.         at: 0@((height - switchForm height) // 2).
  3234.     pictureForm displayOn: combinedForm 
  3235.         at: (switchForm width + separation)@((height - pictureForm height) // 2).
  3236.  
  3237.     ^combinedForm! !
  3238.  
  3239.  
  3240. WindowMakerIcon subclass: #WindowMakerTextIcon
  3241.     instanceVariableNames: ''
  3242.     classVariableNames: ''
  3243.     poolDictionaries: ''
  3244.     category: 'WindowMaker'!
  3245.  
  3246. !WindowMakerTextIcon methodsFor: 'instance initialization'!
  3247. initialize
  3248.     super initialize.
  3249.     defaultLabelSelector _ #getText!
  3250. initializeMessages
  3251.     super initializeMessages.
  3252.     self
  3253.         addMessage: #comment default: #defaultComment
  3254.             parser: #parseComment: coding: nil;
  3255.         addMessage: #updateSymbol default: #defaultUpdateSymbol
  3256.             parser: #parseNilOrSymbol: coding: #(nil);
  3257.         addMessage: #getText default: #defaultGetText
  3258.             parser: #parseZeroOrMoreParametersMessage: coding: #(model getText);
  3259.         addMessage: #changeText default: #defaultChangeText
  3260.             parser: #parseOneOrMoreParametersMessage: coding: #(model changeText: aText);
  3261.         addMessage: #getMenu default: #defaultGetYellowMenu
  3262.             parser: #parseNilOrZeroOrMoreParameterMessage: coding: #(model getMenu)! !
  3263.  
  3264. !WindowMakerTextIcon methodsFor: 'encoding/decoding'!
  3265. decodeFrom: aStream
  3266.     "iconClass iconName window insideColor borderWidth (updateSymbol getTextMessage changeTextMessage getMenuMessage)"
  3267.  
  3268.     | newStream |
  3269.     super decodeFrom: aStream.
  3270.     newStream _ ReadStream on: aStream next.
  3271.     self
  3272.         changeMessage: #updateSymbol receiver: newStream next;
  3273.         changeMessage: #getText selectorArguments: newStream next;
  3274.         changeMessage: #changeText selectorArguments: newStream next;
  3275.         changeMessage: #getMenu selectorArguments: newStream next!
  3276. encodeOn: aStream
  3277.     "iconClass iconName window insideColor borderWidth (updateSymbol getTextMessage changeTextMessage getMenuMessage)"
  3278.  
  3279.     super encodeOn: aStream.
  3280.     aStream
  3281.         space; nextPut: $(; store: (self receiverFor: #updateSymbol);
  3282.         space; store: (self codingWithoutReceiverFor: #getText);
  3283.         space; store: (self codingWithoutReceiverFor: #changeText);
  3284.         space; store: (self codingWithoutReceiverFor: #getMenu);
  3285.         nextPut: $)! !
  3286.  
  3287. !WindowMakerTextIcon methodsFor: 'generating views'!
  3288. asView
  3289.     ^(ExtendedTextView on: nil
  3290.         aspect: (self receiverFor: #updateSymbol)
  3291.         get: (self selectorArgumentsFor: #getText)
  3292.         change: (self selectorArgumentsFor: #changeText)
  3293.         menu: (self selectorArgumentsFor: #getMenu))
  3294.         name: (self receiverFor: #name);
  3295.         insideColor: insideColor;
  3296.         borderWidthLeft: borderWidth left right: borderWidth right 
  3297.             top: borderWidth top bottom: borderWidth bottom;
  3298.         window: window;
  3299.         transformation: transformation;
  3300.         yourself! !
  3301.  
  3302. !WindowMakerTextIcon methodsFor: 'interface window defaults'!
  3303. defaultChangeText
  3304.     ^Text
  3305.         string: '
  3306.     model changeText: #aText
  3307.  
  3308. "other examples:
  3309.     model changeNameTextTo: #aText for: #manager
  3310.     model changeVitaeTextTo: #aText for: #personnel version: #short
  3311.  
  3312. comment: The change-text message is used by the text window give the model updated text to be recorded. This text is provided in the first parameter.
  3313.  
  3314. when used: This message is sent to the model when the user accepts the text in the text window.
  3315.  
  3316. restrictions: The receiver must be ''model''. One or more constant parameters can be specified; nil, true, and false are permitted. The first parameter (#aText above) is replaced by the actual text before the message is sent. The result returned must be a boolean with the following interpretation: true - the text has been recorded, false - the text has not been recorded (it has been rejected). Typically, true is returned.
  3317.  
  3318. warning: The text object given to the model is the actual text used by the text window. Hence, the window may subsequently physically modify it. To ensure that the version maintained by the model is left intact, the changeText method should store a copy.
  3319.  
  3320. optional: Prior to sending a changeText message, the window always asks the model for permission by sending it a ''changeRequestFrom: aView'' message. The default inherited by all objects is to reply true if no other windows contain unaccepted modified text (interactive prompting occurs). If this default is not acceptable, the model will need to incorporate its own special version such as the following:
  3321.  
  3322.      changeRequestFrom: aView
  3323.         ^true"'
  3324.         runs: (RunArray
  3325.             runs: #(8 10 11 14 9 28 18 29 13 7 10 7 5 12 127 9 88 12 82 3 2 4 6 5 183 4 31 5 88 7 205 41 1 10 106 24 270 17 16 )
  3326.             values: #(1 2 1 2 1 2 1 2 1 2 1 2 1 2 1 2 1 2 1 2 1 2 1 2 1 2 1 2 1 2 1 2 1 2 1 2 1 2 1 ))!
  3327. defaultComment
  3328.     ^Text 
  3329.         string: '
  3330. A text window communicates with its model via messages
  3331.  
  3332.     (1)    getText to obtain the text to be displayed from the model.
  3333.     (2)    changeText to provide the model with modified text.
  3334.     (3)    getMenu to obtain the yellow pop-up menu from the model.
  3335.  
  3336. updateSymbol comments: If the model changes its copy of the text and the window should reflect the model''s version, the model should send a ''self changed: #updateSymbol'' message. This could be done anywhere including in the above three methods.
  3337.  
  3338. text comments: The getText and changeText messages respectively obtain and provide a text object; a string is not allowed. Moreover, the text object is destructively modified by the view. If the model''s version of the text is to be separate from the view''s version, a copy should be saved or provided respectively.' 
  3339.         runs: (RunArray 
  3340.             runs: #(3 11 48 7 57 10 47 7 51 21 225 13 301) 
  3341.             values: #(1 2 1 2 1 2 1 2 1 2 1 2 1))!
  3342. defaultGetText
  3343.     ^Text
  3344.         string: '
  3345.     model getText
  3346.  
  3347. "other examples:
  3348.     model getNameTextFor: #manager
  3349.     model getVitaeTextFor: #personnel version: #short
  3350.  
  3351. comment: The get-text message is used by the text window to ask the model for the text to be displayed.
  3352.  
  3353. when used: This message is sent to the model (1) when the window is initially displayed and (2) each time it reacts to a ''self changed: #updateSymbol'' message sent by the model. 
  3354.  
  3355. restrictions: The receiver must be ''model''. Any number of constant parameters can be specified; nil, true, and false are permitted. The result returned must be a text object; a string will not suffice.
  3356.  
  3357. warning: The text object given to the text window is physically modified. To ensure that the version maintained by the model is left intact, the getText method should return a copy."'
  3358.         runs: (RunArray
  3359.             runs: #(8 7 3 14 9 14 18 15 13 7 10 7 5 9 84 9 171 12 84 3 2 4 6 5 87 7 134 39 2 )
  3360.             values: #(1 2 1 2 1 2 1 2 1 2 1 2 1 2 1 2 1 2 1 2 1 2 1 2 1 2 1 2 1 ))! !
  3361.  
  3362. Smalltalk garbageCollect!
  3363.  
  3364. WindowMaker initialize!
  3365.